| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -868,23 +868,31 @@ tarballs or zipfiles. | |||
| 868 | 868 | ||
| 869 | 869 | Create an archive file (eg. ``zip`` or ``tar``). *base_name* is the name of | |
| 870 | 870 | the file to create, minus any format-specific extension; *format* is the | |
| 871 | - archive format: one of ``zip``, ``tar``, ``ztar``, or ``gztar``. *root_dir* is | ||
| 872 | - a directory that will be the root directory of the archive; ie. we typically | ||
| 873 | - ``chdir`` into *root_dir* before creating the archive. *base_dir* is the | ||
| 874 | - directory where we start archiving from; ie. *base_dir* will be the common | ||
| 875 | - prefix of all files and directories in the archive. *root_dir* and *base_dir* | ||
| 876 | - both default to the current directory. Returns the name of the archive file. | ||
| 871 | + archive format: one of ``zip``, ``tar``, ``gztar``, ``bztar``, ``xztar``, or | ||
| 872 | + ``ztar``. *root_dir* is a directory that will be the root directory of the | ||
| 873 | + archive; ie. we typically ``chdir`` into *root_dir* before creating the | ||
| 874 | + archive. *base_dir* is the directory where we start archiving from; ie. | ||
| 875 | + *base_dir* will be the common prefix of all files and directories in the | ||
| 876 | + archive. *root_dir* and *base_dir* both default to the current directory. | ||
| 877 | + Returns the name of the archive file. | ||
| 878 | + | ||
| 879 | + .. versionchanged: 3.5 | ||
| 880 | + Added support for the ``xztar`` format. | ||
| 877 | 881 | ||
| 878 | 882 | ||
| 879 | 883 | .. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=0, dry_run=0]) | |
| 880 | 884 | ||
| 881 | 885 | 'Create an (optional compressed) archive as a tar file from all files in and | |
| 882 | - under *base_dir*. *compress* must be ``'gzip'`` (the default), ``'compress'``, | ||
| 883 | - ``'bzip2'``, or ``None``. Both :program:`tar` and the compression utility named | ||
| 884 | - by *compress* must be on the default program search path, so this is probably | ||
| 885 | - Unix-specific. The output tar file will be named :file:`base_dir.tar`, | ||
| 886 | - possibly plus the appropriate compression extension (:file:`.gz`, :file:`.bz2` | ||
| 887 | - or :file:`.Z`). Return the output filename. | ||
| 886 | + under *base_dir*. *compress* must be ``'gzip'`` (the default), | ||
| 887 | + ``'bzip2'``, ``'xz'``, ``'compress'``, or ``None``. For the ``'compress'`` | ||
| 888 | + method the compression utility named by :program:`compress` must be on the | ||
| 889 | + default program search path, so this is probably Unix-specific. The output | ||
| 890 | + tar file will be named :file:`base_dir.tar`, possibly plus the appropriate | ||
| 891 | + compression extension (``.gz``, ``.bz2``, ``.xz`` or ``.Z``). Return the | ||
| 892 | + output filename. | ||
| 893 | + | ||
| 894 | + .. versionchanged: 3.5 | ||
| 895 | + Added support for the ``xz`` compression. | ||
| 888 | 896 | ||
| 889 | 897 | ||
| 890 | 898 | .. function:: make_zipfile(base_name, base_dir[, verbose=0, dry_run=0]) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,13 +72,19 @@ The available formats for built distributions are: | |||
| 72 | 72 | +-------------+------------------------------+---------+ | |
| 73 | 73 | | Format | Description | Notes | | |
| 74 | 74 | +=============+==============================+=========+ | |
| 75 | - | ``gztar`` | gzipped tar file | (1),(3) | | ||
| 75 | + | ``gztar`` | gzipped tar file | \(1) | | ||
| 76 | 76 | | | (:file:`.tar.gz`) | | | |
| 77 | 77 | +-------------+------------------------------+---------+ | |
| 78 | + | ``bztar`` | bzipped tar file | | | ||
| 79 | + | | (:file:`.tar.bz2`) | | | ||
| 80 | + +-------------+------------------------------+---------+ | ||
| 81 | + | ``xztar`` | xzipped tar file | | | ||
| 82 | + | | (:file:`.tar.xz`) | | | ||
| 83 | + +-------------+------------------------------+---------+ | ||
| 78 | 84 | | ``ztar`` | compressed tar file | \(3) | | |
| 79 | 85 | | | (:file:`.tar.Z`) | | | |
| 80 | 86 | +-------------+------------------------------+---------+ | |
| 81 | - | ``tar`` | tar file (:file:`.tar`) | \(3) | | ||
| 87 | + | ``tar`` | tar file (:file:`.tar`) | | | ||
| 82 | 88 | +-------------+------------------------------+---------+ | |
| 83 | 89 | | ``zip`` | zip file (:file:`.zip`) | (2),(4) | | |
| 84 | 90 | +-------------+------------------------------+---------+ | |
@@ -94,6 +100,9 @@ The available formats for built distributions are: | |||
| 94 | 100 | | ``msi`` | Microsoft Installer. | | | |
| 95 | 101 | +-------------+------------------------------+---------+ | |
| 96 | 102 | ||
| 103 | + .. versionchanged: 3.5 | ||
| 104 | + Added support for the ``xztar`` format. | ||
| 105 | + | ||
| 97 | 106 | ||
| 98 | 107 | Notes: | |
| 99 | 108 | ||
@@ -104,8 +113,7 @@ Notes: | |||
| 104 | 113 | default on Windows | |
| 105 | 114 | ||
| 106 | 115 | (3) | |
| 107 | - requires external utilities: :program:`tar` and possibly one of :program:`gzip`, | ||
| 108 | - :program:`bzip2`, or :program:`compress` | ||
| 116 | + requires external :program:`compress` utility. | ||
| 109 | 117 | ||
| 110 | 118 | (4) | |
| 111 | 119 | requires either external :program:`zip` utility or :mod:`zipfile` module (part | |
@@ -119,21 +127,22 @@ You don't have to use the :command:`bdist` command with the :option:`--formats` | |||
| 119 | 127 | option; you can also use the command that directly implements the format you're | |
| 120 | 128 | interested in. Some of these :command:`bdist` "sub-commands" actually generate | |
| 121 | 129 | several similar formats; for instance, the :command:`bdist_dumb` command | |
| 122 | - generates all the "dumb" archive formats (``tar``, ``ztar``, ``gztar``, and | ||
| 123 | - ``zip``), and :command:`bdist_rpm` generates both binary and source RPMs. The | ||
| 124 | - :command:`bdist` sub-commands, and the formats generated by each, are: | ||
| 125 | - | ||
| 126 | - +--------------------------+-----------------------+ | ||
| 127 | - | Command | Formats | | ||
| 128 | - +==========================+=======================+ | ||
| 129 | - | :command:`bdist_dumb` | tar, ztar, gztar, zip | | ||
| 130 | - +--------------------------+-----------------------+ | ||
| 131 | - | :command:`bdist_rpm` | rpm, srpm | | ||
| 132 | - +--------------------------+-----------------------+ | ||
| 133 | - | :command:`bdist_wininst` | wininst | | ||
| 134 | - +--------------------------+-----------------------+ | ||
| 135 | - | :command:`bdist_msi` | msi | | ||
| 136 | - +--------------------------+-----------------------+ | ||
| 130 | + generates all the "dumb" archive formats (``tar``, ``gztar``, ``bztar``, | ||
| 131 | + ``xztar``, ``ztar``, and ``zip``), and :command:`bdist_rpm` generates both | ||
| 132 | + binary and source RPMs. The :command:`bdist` sub-commands, and the formats | ||
| 133 | + generated by each, are: | ||
| 134 | + | ||
| 135 | + +--------------------------+-------------------------------------+ | ||
| 136 | + | Command | Formats | | ||
| 137 | + +==========================+=====================================+ | ||
| 138 | + | :command:`bdist_dumb` | tar, gztar, bztar, xztar, ztar, zip | | ||
| 139 | + +--------------------------+-------------------------------------+ | ||
| 140 | + | :command:`bdist_rpm` | rpm, srpm | | ||
| 141 | + +--------------------------+-------------------------------------+ | ||
| 142 | + | :command:`bdist_wininst` | wininst | | ||
| 143 | + +--------------------------+-------------------------------------+ | ||
| 144 | + | :command:`bdist_msi` | msi | | ||
| 145 | + +--------------------------+-------------------------------------+ | ||
| 137 | 146 | ||
| 138 | 147 | The following sections give details on the individual :command:`bdist_\*` | |
| 139 | 148 | commands. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,12 +32,18 @@ to create a gzipped tarball and a zip file. The available formats are: | |||
| 32 | 32 | | ``bztar`` | bzip2'ed tar file | | | |
| 33 | 33 | | | (:file:`.tar.bz2`) | | | |
| 34 | 34 | +-----------+-------------------------+---------+ | |
| 35 | + | ``xztar`` | xz'ed tar file | | | ||
| 36 | + | | (:file:`.tar.xz`) | | | ||
| 37 | + +-----------+-------------------------+---------+ | ||
| 35 | 38 | | ``ztar`` | compressed tar file | \(4) | | |
| 36 | 39 | | | (:file:`.tar.Z`) | | | |
| 37 | 40 | +-----------+-------------------------+---------+ | |
| 38 | 41 | | ``tar`` | tar file (:file:`.tar`) | | | |
| 39 | 42 | +-----------+-------------------------+---------+ | |
| 40 | 43 | ||
| 44 | + .. versionchanged: 3.5 | ||
| 45 | + Added support for the ``xztar`` format. | ||
| 46 | + | ||
| 41 | 47 | Notes: | |
| 42 | 48 | ||
| 43 | 49 | (1) | |
@@ -54,7 +60,7 @@ Notes: | |||
| 54 | 60 | requires the :program:`compress` program. Notice that this format is now | |
| 55 | 61 | pending for deprecation and will be removed in the future versions of Python. | |
| 56 | 62 | ||
| 57 | - When using any ``tar`` format (``gztar``, ``bztar``, ``ztar`` or | ||
| 63 | + When using any ``tar`` format (``gztar``, ``bztar``, ``xztar``, ``ztar`` or | ||
| 58 | 64 | ``tar``), under Unix you can specify the ``owner`` and ``group`` names | |
| 59 | 65 | that will be set for each member of the archive. | |
| 60 | 66 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -338,6 +338,9 @@ distutils | |||
| 338 | 338 | option to enable parallel building of extension modules. | |
| 339 | 339 | (Contributed by Antoine Pitrou in :issue:`5309`.) | |
| 340 | 340 | ||
| 341 | + * Added support for the LZMA compression. | ||
| 342 | + (Contributed by Serhiy Storchaka in :issue:`16314`.) | ||
| 343 | + | ||
| 341 | 344 | doctest | |
| 342 | 345 | ------- | |
| 343 | 346 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,26 +57,28 @@ def make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, | |||
| 57 | 57 | """Create a (possibly compressed) tar file from all the files under | |
| 58 | 58 | 'base_dir'. | |
| 59 | 59 | ||
| 60 | - 'compress' must be "gzip" (the default), "compress", "bzip2", or None. | ||
| 61 | - (compress will be deprecated in Python 3.2) | ||
| 60 | + 'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or | ||
| 61 | + None. ("compress" will be deprecated in Python 3.2) | ||
| 62 | 62 | ||
| 63 | 63 | 'owner' and 'group' can be used to define an owner and a group for the | |
| 64 | 64 | archive that is being built. If not provided, the current owner and group | |
| 65 | 65 | will be used. | |
| 66 | 66 | ||
| 67 | 67 | The output tar file will be named 'base_dir' + ".tar", possibly plus | |
| 68 | - the appropriate compression extension (".gz", ".bz2" or ".Z"). | ||
| 68 | + the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z"). | ||
| 69 | 69 | ||
| 70 | 70 | Returns the output filename. | |
| 71 | 71 | """ | |
| 72 | - tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', None: '', 'compress': ''} | ||
| 73 | - compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'compress': '.Z'} | ||
| 72 | + tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', 'xz': 'xz', None: '', | ||
| 73 | + 'compress': ''} | ||
| 74 | + compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'xz': '.xz', | ||
| 75 | + 'compress': '.Z'} | ||
| 74 | 76 | ||
| 75 | 77 | # flags for compression program, each element of list will be an argument | |
| 76 | 78 | if compress is not None and compress not in compress_ext.keys(): | |
| 77 | 79 | raise ValueError( | |
| 78 | - "bad value for 'compress': must be None, 'gzip', 'bzip2' " | ||
| 79 | - "or 'compress'") | ||
| 80 | + "bad value for 'compress': must be None, 'gzip', 'bzip2', " | ||
| 81 | + "'xz' or 'compress'") | ||
| 80 | 82 | ||
| 81 | 83 | archive_name = base_name + '.tar' | |
| 82 | 84 | if compress != 'compress': | |
@@ -177,6 +179,7 @@ def make_zipfile(base_name, base_dir, verbose=0, dry_run=0): | |||
| 177 | 179 | ARCHIVE_FORMATS = { | |
| 178 | 180 | 'gztar': (make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), | |
| 179 | 181 | 'bztar': (make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), | |
| 182 | + 'xztar': (make_tarball, [('compress', 'xz')], "xz'ed tar-file"), | ||
| 180 | 183 | 'ztar': (make_tarball, [('compress', 'compress')], "compressed tar file"), | |
| 181 | 184 | 'tar': (make_tarball, [('compress', None)], "uncompressed tar file"), | |
| 182 | 185 | 'zip': (make_zipfile, [],"ZIP file") | |
@@ -197,8 +200,8 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, | |||
| 197 | 200 | """Create an archive file (eg. zip or tar). | |
| 198 | 201 | ||
| 199 | 202 | 'base_name' is the name of the file to create, minus any format-specific | |
| 200 | - extension; 'format' is the archive format: one of "zip", "tar", "ztar", | ||
| 201 | - or "gztar". | ||
| 203 | + extension; 'format' is the archive format: one of "zip", "tar", "gztar", | ||
| 204 | + "bztar", "xztar", or "ztar". | ||
| 202 | 205 | ||
| 203 | 206 | 'root_dir' is a directory that will be the root directory of the | |
| 204 | 207 | archive; ie. we typically chdir into 'root_dir' before creating the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,13 +61,14 @@ class bdist(Command): | |||
| 61 | 61 | 'nt': 'zip'} | |
| 62 | 62 | ||
| 63 | 63 | # Establish the preferred order (for the --help-formats option). | |
| 64 | - format_commands = ['rpm', 'gztar', 'bztar', 'ztar', 'tar', | ||
| 64 | + format_commands = ['rpm', 'gztar', 'bztar', 'xztar', 'ztar', 'tar', | ||
| 65 | 65 | 'wininst', 'zip', 'msi'] | |
| 66 | 66 | ||
| 67 | 67 | # And the real information. | |
| 68 | 68 | format_command = {'rpm': ('bdist_rpm', "RPM distribution"), | |
| 69 | 69 | 'gztar': ('bdist_dumb', "gzip'ed tar file"), | |
| 70 | 70 | 'bztar': ('bdist_dumb', "bzip2'ed tar file"), | |
| 71 | + 'xztar': ('bdist_dumb', "xz'ed tar file"), | ||
| 71 | 72 | 'ztar': ('bdist_dumb', "compressed tar file"), | |
| 72 | 73 | 'tar': ('bdist_dumb', "tar file"), | |
| 73 | 74 | 'wininst': ('bdist_wininst', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,8 @@ class bdist_dumb(Command): | |||
| 22 | 22 | "platform name to embed in generated filenames " | |
| 23 | 23 | "(default: %s)" % get_platform()), | |
| 24 | 24 | ('format=', 'f', | |
| 25 | - "archive format to create (tar, ztar, gztar, zip)"), | ||
| 25 | + "archive format to create (tar, gztar, bztar, xztar, " | ||
| 26 | + "ztar, zip)"), | ||
| 26 | 27 | ('keep-temp', 'k', | |
| 27 | 28 | "keep the pseudo-installation tree around after " + | |
| 28 | 29 | "creating the distribution archive"), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments