Skip to content

Commit 5226b3a

Browse files
committed
Fix time
1 parent b3fbea1 commit 5226b3a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

utils/zipfile_deterministic.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import struct, os, time, sys, shutil
99
import binascii, cStringIO, stat
10-
import unicodedata
1110

1211
try:
1312
import zlib # We may need its compression method
@@ -279,7 +278,7 @@ def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
279278
if os.sep != "/" and os.sep in filename:
280279
filename = filename.replace(os.sep, "/")
281280

282-
self.filename = normalize(filename) # Normalized file name
281+
self.filename = normalize_unicode(filename) # Normalized file name
283282
self.date_time = date_time # year, month, day, hour, min, sec
284283
# Standard values:
285284
self.compress_type = ZIP_STORED # Type of compression for the file
@@ -1006,7 +1005,7 @@ def _writecheck(self, zinfo):
10061005
if not self._allowZip64:
10071006
raise LargeZipFile("Zipfile size would require ZIP64 extensions")
10081007

1009-
def write(self, filename, arcname=None, compress_type=None):
1008+
def write(self, filename, arcname=None, compress_type=None, date_time=(1980,1,1,0,0,0)):
10101009
"""Put the bytes from filename into the archive under the name
10111010
arcname."""
10121011
if not self.fp:
@@ -1015,8 +1014,6 @@ def write(self, filename, arcname=None, compress_type=None):
10151014

10161015
st = os.stat(filename)
10171016
isdir = stat.S_ISDIR(st.st_mode)
1018-
mtime = time.localtime(st.st_mtime)
1019-
date_time = mtime[0:6]
10201017
# Create ZipInfo instance to store file information
10211018
if arcname is None:
10221019
arcname = filename

0 commit comments

Comments
 (0)