diff options
author | Greg Ward <gward@python.net> | 1999-10-23 19:25:05 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 1999-10-23 19:25:05 (GMT) |
commit | e1ada50559c94da6fe7d16dd205f17e02d1f0aee (patch) | |
tree | 4581e7095348f7e702e26e35a413dd07b8df6a7f /Lib | |
parent | d6c30f66c71a8cfeab153e083af61e04190bbe2c (diff) | |
download | cpython-e1ada50559c94da6fe7d16dd205f17e02d1f0aee.zip cpython-e1ada50559c94da6fe7d16dd205f17e02d1f0aee.tar.gz cpython-e1ada50559c94da6fe7d16dd205f17e02d1f0aee.tar.bz2 |
Don't assume GNU tar -- generate tar file and compress in separate steps.
Now supports the full range of intended formats (tar, ztar, gztar, zip).
"-f" no longer a short option for "--formats" -- conflicts with new
global option "--force"!
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/command/dist.py | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/Lib/distutils/command/dist.py b/Lib/distutils/command/dist.py index 57db1d7..abbd625 100644 --- a/Lib/distutils/command/dist.py +++ b/Lib/distutils/command/dist.py @@ -129,7 +129,7 @@ from distutils.text_file import TextFile class Dist (Command): - options = [('formats=', 'f', + options = [('formats=', None, "formats for source distribution (tar, ztar, gztar, or zip)"), ('manifest=', 'm', "name of manifest file"), @@ -385,17 +385,23 @@ class Dist (Command): # make_release_tree () - def make_tarball (self, base_dir): + def make_tarball (self, base_dir, compress="gzip"): # XXX GNU tar 1.13 has a nifty option to add a prefix directory. - # It's pretty new, though, so we certainly can't require it -- but - # it would be nice to take advantage of it to skip the "create a - # tree of hardlinks" step! + # It's pretty new, though, so we certainly can't require it -- + # but it would be nice to take advantage of it to skip the + # "create a tree of hardlinks" step! (Would also be nice to + # detect GNU tar to use its 'z' option and save a step.) - # But I am a lazy bastard, so I require GNU tar anyways. + if compress is not None and compress not in ('gzip', 'compress'): + raise ValueError, \ + "if given, 'compress' must be 'gzip' or 'compress'" - archive_name = base_dir + ".tar.gz" - self.spawn (["tar", "-czf", archive_name, base_dir]) + archive_name = base_dir + ".tar" + self.spawn (["tar", "-cf", archive_name, base_dir]) + + if compress: + self.spawn ([compress, archive_name]) def make_zipfile (self, base_dir): @@ -425,10 +431,15 @@ class Dist (Command): self.exclude_files (base_dir + "*") self.make_release_tree (base_dir, self.files) - if 'gztar' in self.formats: - self.make_tarball (base_dir) - if 'zip' in self.formats: - self.make_zipfile (base_dir) + for fmt in self.formats: + if fmt == 'gztar': + self.make_tarball (base_dir, compress='gzip') + elif fmt == 'ztar': + self.make_tarball (base_dir, compress='compress') + elif fmt == 'tar': + self.make_tarball (base_dir, compress=None) + elif fmt == 'zip': + self.make_zipfile (base_dir) # class Dist |