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:23:33 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/sourcedist.rst --- a/Doc/distutils/sourcedist.rst Tue Oct 23 22:50:11 2012 +0100 +++ b/Doc/distutils/sourcedist.rst Thu Oct 25 00:23:33 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:23:33 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':