Skip to content

Commit

Permalink
Fix archive script to set timestamps properly for .tar.gz
Browse files Browse the repository at this point in the history
By default they are set to Jan 1 1970 which breaks homebrew.

Fixes zeux#124.
  • Loading branch information
zeux committed Nov 27, 2016
1 parent 91bf702 commit d2deb42
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/archive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os.path
import sys
import tarfile
import time
import zipfile
import StringIO

Expand Down Expand Up @@ -29,6 +30,7 @@ def write_tar(target, arcprefix, sources, compression):
path = os.path.join(arcprefix, source)
info = tarfile.TarInfo(path)
info.size = len(data)
info.mtime = time.time()
archive.addfile(info, StringIO.StringIO(data))

if len(sys.argv) < 4:
Expand All @@ -43,4 +45,4 @@ def write_tar(target, arcprefix, sources, compression):
elif target.endswith('.tar.gz') or target.endswith('.tar.bz2'):
write_tar(target, arcprefix, sources, compression = os.path.splitext(target)[1][1:])
else:
raise NotImplementedError('File type not supported: ' + target)
raise NotImplementedError('File type not supported: ' + target)

0 comments on commit d2deb42

Please sign in to comment.