From 488b6f8ccdd50eb31057b544b551db14f325fb46 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sat, 12 May 2012 23:33:11 -0700 Subject: [PATCH] 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