Skip to content

Commit

Permalink
Merge pull request #3651 from JesperDramsch/gzip
Browse files Browse the repository at this point in the history
Skip shlex for win32 platforms and make gzip deerministic
  • Loading branch information
Kwpolska committed Dec 10, 2022
2 parents 0e56c60 + 35d30ab commit 9df43da
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Features

* Add a ``--timeout`` parameter to the ``check`` plugin, defaulting to
30s. (Issue #3643)
* GZIP compression is now deterministic for automatic deploys (Issue #3650)

Bug Fixes
---------

* `GZIP_COMMAND` parsing on `win32` platforms (Issue#3649)

New in v8.2.3
=============
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/gzip.plugin
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module = gzip

[Documentation]
author = Roberto Alsina
version = 1.0
version = 1.1
website = https://getnikola.com/
description = Create gzipped copies of files

Expand Down
8 changes: 6 additions & 2 deletions nikola/plugins/task/gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import os
import shlex
import subprocess
import sys

from nikola.plugin_categories import TaskMultiplier

Expand Down Expand Up @@ -73,8 +74,11 @@ def process(self, task, prefix):
def create_gzipped_copy(in_path, out_path, command=None):
"""Create gzipped copy of in_path and save it as out_path."""
if command:
subprocess.check_call(shlex.split(command.format(filename=in_path)))
if sys.platform == 'win32':
subprocess.check_call(command.format(filename=in_path))
else:
subprocess.check_call(shlex.split(command.format(filename=in_path)))
else:
with gzip.GzipFile(out_path, 'wb+') as outf:
with gzip.GzipFile(out_path, 'wb+', mtime=0) as outf:
with open(in_path, 'rb') as inf:
outf.write(inf.read())

0 comments on commit 9df43da

Please sign in to comment.