mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 14:52:26 +00:00
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
This commit is contained in:
parent
379901bf8f
commit
488b6f8ccd
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user