diff -r 0acc5626a578 Doc/distutils/apiref.rst --- a/Doc/distutils/apiref.rst Tue Oct 23 22:50:11 2012 +0100 +++ b/Doc/distutils/apiref.rst Thu Oct 25 00:54:17 2012 +0300 @@ -870,23 +870,25 @@ Create an archive file (eg. ``zip`` or ``tar``). *base_name* is the name of the file to create, minus any format-specific extension; *format* is the - archive format: one of ``zip``, ``tar``, ``ztar``, or ``gztar``. *root_dir* is - a directory that will be the root directory of the archive; ie. we typically - ``chdir`` into *root_dir* before creating the archive. *base_dir* is the - directory where we start archiving from; ie. *base_dir* will be the common - prefix of all files and directories in the archive. *root_dir* and *base_dir* - both default to the current directory. Returns the name of the archive file. + archive format: one of ``zip``, ``tar``, ``ztar``, ``gztar``, ``bztar``, or + ``xztar``. *root_dir* is a directory that will be the root directory of the + archive; ie. we typically ``chdir`` into *root_dir* before creating the + archive. *base_dir* is the directory where we start archiving from; ie. + *base_dir* will be the common prefix of all files and directories in the + archive. *root_dir* and *base_dir* both default to the current directory. + Returns the name of the archive file. .. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=0, dry_run=0]) 'Create an (optional compressed) archive as a tar file from all files in and - under *base_dir*. *compress* must be ``'gzip'`` (the default), ``'compress'``, - ``'bzip2'``, or ``None``. Both :program:`tar` and the compression utility named - by *compress* must be on the default program search path, so this is probably - Unix-specific. The output tar file will be named :file:`base_dir.tar`, - possibly plus the appropriate compression extension (:file:`.gz`, :file:`.bz2` - or :file:`.Z`). Return the output filename. + under *base_dir*. *compress* must be ``'gzip'`` (the default), + ``'compress'``, ``'bzip2'``, ``'xz'``, or ``None``. Both :program:`tar` + and the compression utility named by *compress* must be on the default + program search path, so this is probably Unix-specific. The output tar + file will be named :file:`base_dir.tar`, possibly plus the appropriate + compression extension (:file:`.gz`, :file:`.bz2`, :file:`.xz` or + :file:`.Z`). Return the output filename. .. function:: make_zipfile(base_name, base_dir[, verbose=0, dry_run=0]) diff -r 0acc5626a578 Doc/distutils/builtdist.rst --- a/Doc/distutils/builtdist.rst Tue Oct 23 22:50:11 2012 +0100 +++ b/Doc/distutils/builtdist.rst Thu Oct 25 00:54:17 2012 +0300 @@ -75,6 +75,12 @@ | ``gztar`` | gzipped tar file | (1),(3) | | | (:file:`.tar.gz`) | | +-------------+------------------------------+---------+ +| ``bztar`` | bzipped tar file | (1),(3) | +| | (:file:`.tar.bz2`) | | ++-------------+------------------------------+---------+ +| ``xztar`` | xzipped tar file | (1),(3) | +| | (:file:`.tar.xz`) | | ++-------------+------------------------------+---------+ | ``ztar`` | compressed tar file | \(3) | | | (:file:`.tar.Z`) | | +-------------+------------------------------+---------+ @@ -105,7 +111,7 @@ (3) requires external utilities: :program:`tar` and possibly one of :program:`gzip`, - :program:`bzip2`, or :program:`compress` + :program:`bzip2`, :program:`xz`, or :program:`compress` (4) requires either external :program:`zip` utility or :mod:`zipfile` module (part @@ -119,21 +125,22 @@ option; you can also use the command that directly implements the format you're interested in. Some of these :command:`bdist` "sub-commands" actually generate several similar formats; for instance, the :command:`bdist_dumb` command -generates all the "dumb" archive formats (``tar``, ``ztar``, ``gztar``, and -``zip``), and :command:`bdist_rpm` generates both binary and source RPMs. The -:command:`bdist` sub-commands, and the formats generated by each, are: +generates all the "dumb" archive formats (``tar``, ``ztar``, ``gztar``, +``bztar``, ``xztar``, and ``zip``), and :command:`bdist_rpm` generates both +binary and source RPMs. The :command:`bdist` sub-commands, and the formats +generated by each, are: -+--------------------------+-----------------------+ -| Command | Formats | -+==========================+=======================+ -| :command:`bdist_dumb` | tar, ztar, gztar, zip | -+--------------------------+-----------------------+ -| :command:`bdist_rpm` | rpm, srpm | -+--------------------------+-----------------------+ -| :command:`bdist_wininst` | wininst | -+--------------------------+-----------------------+ -| :command:`bdist_msi` | msi | -+--------------------------+-----------------------+ ++--------------------------+-------------------------------------+ +| Command | Formats | ++==========================+=====================================+ +| :command:`bdist_dumb` | tar, ztar, gztar, bztar, xztar, zip | ++--------------------------+-------------------------------------+ +| :command:`bdist_rpm` | rpm, srpm | ++--------------------------+-------------------------------------+ +| :command:`bdist_wininst` | wininst | ++--------------------------+-------------------------------------+ +| :command:`bdist_msi` | msi | ++--------------------------+-------------------------------------+ The following sections give details on the individual :command:`bdist_\*` commands. diff -r 0acc5626a578 Doc/distutils/sourcedist.rst --- a/Doc/distutils/sourcedist.rst Tue Oct 23 22:50:11 2012 +0100 +++ b/Doc/distutils/sourcedist.rst Thu Oct 25 00:54:17 2012 +0300 @@ -32,6 +32,9 @@ | ``bztar`` | bzip2'ed tar file | \(4) | | | (:file:`.tar.bz2`) | | +-----------+-------------------------+---------+ +| ``xztar`` | xz'ed tar file | \(4) | +| | (:file:`.tar.xz`) | | ++-----------+-------------------------+---------+ | ``ztar`` | compressed tar file | \(4) | | | (:file:`.tar.Z`) | | +-----------+-------------------------+---------+ @@ -52,7 +55,7 @@ (4) requires external utilities: :program:`tar` and possibly one of :program:`gzip`, - :program:`bzip2`, or :program:`compress` + :program:`bzip2`, :program:`xz`, or :program:`compress` .. _manifest: diff -r 0acc5626a578 Lib/distutils/archive_util.py --- a/Lib/distutils/archive_util.py Tue Oct 23 22:50:11 2012 +0100 +++ b/Lib/distutils/archive_util.py Thu Oct 25 00:54:17 2012 +0300 @@ -22,21 +22,23 @@ """Create a (possibly compressed) tar file from all the files under 'base_dir'. - 'compress' must be "gzip" (the default), "compress", "bzip2", or None. - Both "tar" and the compression utility named by 'compress' must be on - the default program search path, so this is probably Unix-specific. + 'compress' must be "gzip" (the default), "compress", "bzip2", "xz", or + None. Both "tar" and the compression utility named by 'compress' must be + on the default program search path, so this is probably Unix-specific. The output tar file will be named 'base_dir' + ".tar", possibly plus - the appropriate compression extension (".gz", ".bz2" or ".Z"). + the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z"). Returns the output filename. """ - tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', None: '', 'compress': ''} - compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'compress': '.Z'} + tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', 'xz': 'xz', None: '', + 'compress': ''} + compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'xz': '.xz', + 'compress': '.Z'} # flags for compression program, each element of list will be an argument if compress is not None and compress not in compress_ext.keys(): raise ValueError( - "bad value for 'compress': must be None, 'gzip', 'bzip2' " - "or 'compress'") + "bad value for 'compress': must be None, 'gzip', 'bzip2', " + "'xz' or 'compress'") archive_name = base_name + '.tar' if compress != 'compress': @@ -124,6 +126,7 @@ ARCHIVE_FORMATS = { 'gztar': (make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'bztar': (make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), + 'xztar': (make_tarball, [('compress', 'xz')], "xz'ed tar-file"), 'ztar': (make_tarball, [('compress', 'compress')], "compressed tar file"), 'tar': (make_tarball, [('compress', None)], "uncompressed tar file"), 'zip': (make_zipfile, [],"ZIP file") @@ -145,7 +148,7 @@ 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "ztar", - or "gztar". + "gztar", "bztar", or "xztar". 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the diff -r 0acc5626a578 Lib/distutils/command/bdist.py --- a/Lib/distutils/command/bdist.py Tue Oct 23 22:50:11 2012 +0100 +++ b/Lib/distutils/command/bdist.py Thu Oct 25 00:54:17 2012 +0300 @@ -55,13 +55,14 @@ 'nt': 'zip'} # Establish the preferred order (for the --help-formats option). - format_commands = ['rpm', 'gztar', 'bztar', 'ztar', 'tar', + format_commands = ['rpm', 'gztar', 'bztar', 'xztar', 'ztar', 'tar', 'wininst', 'zip', 'msi'] # And the real information. format_command = {'rpm': ('bdist_rpm', "RPM distribution"), 'gztar': ('bdist_dumb', "gzip'ed tar file"), 'bztar': ('bdist_dumb', "bzip2'ed tar file"), + 'xztar': ('bdist_dumb', "xz'ed tar file"), 'ztar': ('bdist_dumb', "compressed tar file"), 'tar': ('bdist_dumb', "tar file"), 'wininst': ('bdist_wininst', diff -r 0acc5626a578 Lib/distutils/command/bdist_dumb.py --- a/Lib/distutils/command/bdist_dumb.py Tue Oct 23 22:50:11 2012 +0100 +++ b/Lib/distutils/command/bdist_dumb.py Thu Oct 25 00:54:17 2012 +0300 @@ -22,7 +22,8 @@ "platform name to embed in generated filenames " "(default: %s)" % get_platform()), ('format=', 'f', - "archive format to create (tar, ztar, gztar, zip)"), + "archive format to create (tar, ztar, gztar, bztar, " + "xztar, zip)"), ('keep-temp', 'k', "keep the pseudo-installation tree around after " + "creating the distribution archive"),