From: Brian Warner Date: Sun, 13 May 2012 06:33:11 +0000 (-0700) Subject: test-dont-use-too-old-dep.py: fix tarfile timestamps X-Git-Url: https://git.rkrishnan.org/specifications/components/com_hotproperty/rgr-080307.php?a=commitdiff_plain;h=488b6f8ccdd50eb31057b544b551db14f325fb46;p=tahoe-lafs%2Ftahoe-lafs.git test-dont-use-too-old-dep.py: fix tarfile timestamps It turns out that TarFile.addfile() doesn't provide a reasonable default timestamp, resulting in files dated to 1970 (they're probably wearing bell-bottoms and listening to disco too). Then, when the bdist_egg command tries to create a *zip*file with those files, it explodes because zipfiles cannot handle timestamps before 1980 (it prefers boomboxes and jackets with straps on the shoulders, thank you very much). This puts a modern time.time() on the members of the tarfile, allowing future cryptocoderarchaeologists the opportunity to make fun of fashion trends from the user's chosen era, rather than an artificially older one. refs #1342 --- diff --git a/misc/build_helpers/test-dont-use-too-old-dep.py b/misc/build_helpers/test-dont-use-too-old-dep.py index 4c5e394e..cbe69569 100644 --- a/misc/build_helpers/test-dont-use-too-old-dep.py +++ b/misc/build_helpers/test-dont-use-too-old-dep.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import StringIO, os, platform, shutil, subprocess, sys, tarfile, zipfile +import StringIO, os, platform, shutil, subprocess, sys, tarfile, zipfile, time import pkg_resources def test(): @@ -52,10 +52,12 @@ def test(): sdist.errorlevel = 2 tarinfo = tarfile.TarInfo('setup.py') tarinfo.errorlevel = 2 + tarinfo.mtime = time.time() tarinfo.size = len(sdist_setup) sdist.addfile(tarinfo, StringIO.StringIO(sdist_setup)) tarinfo = tarfile.TarInfo('fakedependency/__init__.py') tarinfo.errorlevel = 2 + tarinfo.mtime = time.time() tarinfo.size = len(sdist_init) sdist.addfile(tarinfo, StringIO.StringIO(sdist_init)) sdist.close()