diff --git a/setup.cfg b/setup.cfg index b011a7e..d6269ab 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,7 +58,7 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Topic :: System :: Shell + Topic :: System :: Shells [options] diff --git a/tools/build_release b/tools/build_release index 51fd87d..970a5a0 100755 --- a/tools/build_release +++ b/tools/build_release @@ -17,6 +17,7 @@ def build_release(): sh(sdists) buildwheels() sh(' '.join([sys.executable, 'tools/retar.py', 'dist/*.gz'])) + sh(' '.join([sys.executable, 'tools/retar.py', 'dist/*.xz'])) if __name__ == '__main__': build_release() diff --git a/tools/release b/tools/release index 2de8e12..2ba4d24 100755 --- a/tools/release +++ b/tools/release @@ -63,7 +63,7 @@ if 'upload' in sys.argv: # Make target dir if it doesn't exist print('1. Uploading IPython to archive.ipython.org') sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version)) - sh('scp *.tar.gz *.whl %s' % release_site) + sh('scp *.tar.gz *.tar.xz *.whl %s' % release_site) print('2. Uploading backup files...') cd(ipbackupdir) diff --git a/tools/retar.py b/tools/retar.py index b81345d..dbc4f0b 100644 --- a/tools/retar.py +++ b/tools/retar.py @@ -35,7 +35,11 @@ old_buf = io.BytesIO() with open(path, "rb") as f: old_buf.write(f.read()) old_buf.seek(0) -old = tarfile.open(fileobj=old_buf, mode="r:gz") +if path.name.endswith("gz"): + r_mode = "r:gz" +if path.name.endswith(("xz", "xz2")): + r_mode = "r:xz" +old = tarfile.open(fileobj=old_buf, mode=r_mode) buf = io.BytesIO() new = tarfile.open(fileobj=buf, mode="w", format=tarfile.GNU_FORMAT) @@ -46,6 +50,7 @@ for i, m in enumerate(old): continue m2 = tarfile.TarInfo(m.name) m2.mtime = min(timestamp, m.mtime) + m2.pax_headers["mtime"] = m2.mtime m2.size = m.size m2.type = m.type m2.linkname = m.linkname @@ -59,9 +64,19 @@ new.close() old.close() buf.seek(0) -with open(path, "wb") as f: - with gzip.GzipFile('', "wb", fileobj=f, mtime=timestamp) as gzf: - gzf.write(buf.read()) + +if r_mode == "r:gz": + with open(path, "wb") as f: + with gzip.GzipFile("", "wb", fileobj=f, mtime=timestamp) as gzf: + gzf.write(buf.read()) +elif r_mode == "r:xz": + import lzma + + with lzma.open(path, "wb") as f: + f.write(buf.read()) + +else: + assert False # checks the archive is valid. archive = tarfile.open(path) diff --git a/tools/toollib.py b/tools/toollib.py index 1555e55..ce37644 100644 --- a/tools/toollib.py +++ b/tools/toollib.py @@ -18,7 +18,7 @@ archive = '%s:%s' % (archive_user, archive_dir) # Build commands # Source dists -sdists = "{python} setup.py sdist --formats=xztar".format(python=sys.executable) +sdists = "{python} setup.py sdist --formats=xztar,gztar".format(python=sys.executable) # Binary dists def buildwheels(): sh("{python} setup.py bdist_wheel".format(python=sys.executable))