From bbb62646632c801aea758b7d87655fb3ab7ff853 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 5 Sep 2013 18:04:05 +0100 Subject: [PATCH] Sun May 13 07:34:03 BST 2012 Brian Warner * 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 --- misc/build_helpers/test-dont-use-too-old-dep.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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() -- 2.45.2