##// END OF EJS Templates
retar correctly xz
Matthias Bussonnier -
Show More
@@ -58,7 +58,7 b' classifiers ='
58 Programming Language :: Python
58 Programming Language :: Python
59 Programming Language :: Python :: 3
59 Programming Language :: Python :: 3
60 Programming Language :: Python :: 3 :: Only
60 Programming Language :: Python :: 3 :: Only
61 Topic :: System :: Shell
61 Topic :: System :: Shells
62
62
63
63
64 [options]
64 [options]
@@ -17,6 +17,7 b' def build_release():'
17 sh(sdists)
17 sh(sdists)
18 buildwheels()
18 buildwheels()
19 sh(' '.join([sys.executable, 'tools/retar.py', 'dist/*.gz']))
19 sh(' '.join([sys.executable, 'tools/retar.py', 'dist/*.gz']))
20 sh(' '.join([sys.executable, 'tools/retar.py', 'dist/*.xz']))
20
21
21 if __name__ == '__main__':
22 if __name__ == '__main__':
22 build_release()
23 build_release()
@@ -63,7 +63,7 b" if 'upload' in sys.argv:"
63 # Make target dir if it doesn't exist
63 # Make target dir if it doesn't exist
64 print('1. Uploading IPython to archive.ipython.org')
64 print('1. Uploading IPython to archive.ipython.org')
65 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
65 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
66 sh('scp *.tar.gz *.whl %s' % release_site)
66 sh('scp *.tar.gz *.tar.xz *.whl %s' % release_site)
67
67
68 print('2. Uploading backup files...')
68 print('2. Uploading backup files...')
69 cd(ipbackupdir)
69 cd(ipbackupdir)
@@ -35,7 +35,11 b' old_buf = io.BytesIO()'
35 with open(path, "rb") as f:
35 with open(path, "rb") as f:
36 old_buf.write(f.read())
36 old_buf.write(f.read())
37 old_buf.seek(0)
37 old_buf.seek(0)
38 old = tarfile.open(fileobj=old_buf, mode="r:gz")
38 if path.name.endswith("gz"):
39 r_mode = "r:gz"
40 if path.name.endswith(("xz", "xz2")):
41 r_mode = "r:xz"
42 old = tarfile.open(fileobj=old_buf, mode=r_mode)
39
43
40 buf = io.BytesIO()
44 buf = io.BytesIO()
41 new = tarfile.open(fileobj=buf, mode="w", format=tarfile.GNU_FORMAT)
45 new = tarfile.open(fileobj=buf, mode="w", format=tarfile.GNU_FORMAT)
@@ -46,6 +50,7 b' for i, m in enumerate(old):'
46 continue
50 continue
47 m2 = tarfile.TarInfo(m.name)
51 m2 = tarfile.TarInfo(m.name)
48 m2.mtime = min(timestamp, m.mtime)
52 m2.mtime = min(timestamp, m.mtime)
53 m2.pax_headers["mtime"] = m2.mtime
49 m2.size = m.size
54 m2.size = m.size
50 m2.type = m.type
55 m2.type = m.type
51 m2.linkname = m.linkname
56 m2.linkname = m.linkname
@@ -59,9 +64,19 b' new.close()'
59 old.close()
64 old.close()
60
65
61 buf.seek(0)
66 buf.seek(0)
62 with open(path, "wb") as f:
67
63 with gzip.GzipFile('', "wb", fileobj=f, mtime=timestamp) as gzf:
68 if r_mode == "r:gz":
64 gzf.write(buf.read())
69 with open(path, "wb") as f:
70 with gzip.GzipFile("", "wb", fileobj=f, mtime=timestamp) as gzf:
71 gzf.write(buf.read())
72 elif r_mode == "r:xz":
73 import lzma
74
75 with lzma.open(path, "wb") as f:
76 f.write(buf.read())
77
78 else:
79 assert False
65
80
66 # checks the archive is valid.
81 # checks the archive is valid.
67 archive = tarfile.open(path)
82 archive = tarfile.open(path)
@@ -18,7 +18,7 b" archive = '%s:%s' % (archive_user, archive_dir)"
18
18
19 # Build commands
19 # Build commands
20 # Source dists
20 # Source dists
21 sdists = "{python} setup.py sdist --formats=xztar".format(python=sys.executable)
21 sdists = "{python} setup.py sdist --formats=xztar,gztar".format(python=sys.executable)
22 # Binary dists
22 # Binary dists
23 def buildwheels():
23 def buildwheels():
24 sh("{python} setup.py bdist_wheel".format(python=sys.executable))
24 sh("{python} setup.py bdist_wheel".format(python=sys.executable))
General Comments 0
You need to be logged in to leave comments. Login now