summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-16 16:58:33 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-16 16:58:33 (GMT)
commit20cdffd8304522a5c10b53f3dccef7e9f5d685bb (patch)
tree9b4d3971258aa29f5b97230c755f538bcec1bc26 /Doc
parent610f5d739dd22bce352bde59dce3985c73aaefab (diff)
downloadcpython-20cdffd8304522a5c10b53f3dccef7e9f5d685bb.zip
cpython-20cdffd8304522a5c10b53f3dccef7e9f5d685bb.tar.gz
cpython-20cdffd8304522a5c10b53f3dccef7e9f5d685bb.tar.bz2
Issue #14061: Misc fixes and cleanups in archiving code in shutil.
Imporoved the documentation and tests for make_archive() and unpack_archive(). Improved error handling when corresponding compress module is not available. Brake circular dependency between shutil and tarfile modules.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/shutil.rst44
1 files changed, 24 insertions, 20 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index 6f50bc3..66e32e6 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -458,6 +458,10 @@ Archiving operations
.. versionadded:: 3.2
+.. versionchanged:: 3.5
+ Added support for the *xztar* format.
+
+
High-level utilities to create and read compressed and archived files are also
provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
@@ -467,8 +471,9 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
*base_name* is the name of the file to create, including the path, minus
any format-specific extension. *format* is the archive format: one of
- "zip", "tar", "bztar" (if the :mod:`bz2` module is available), "xztar"
- (if the :mod:`lzma` module is available) or "gztar".
+ "zip" (if the :mod:`zlib` module is available), "tar", "gztar" (if the
+ :mod:`zlib` module is available), "bztar" (if the :mod:`bz2` module is
+ available), or "xztar" (if the :mod:`lzma` module is available).
*root_dir* is a directory that will be the root directory of the
archive; for example, we typically chdir into *root_dir* before creating the
@@ -491,9 +496,6 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
The *verbose* argument is unused and deprecated.
- .. versionchanged:: 3.5
- Added support for the *xztar* format.
-
.. function:: get_archive_formats()
@@ -502,11 +504,11 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
By default :mod:`shutil` provides these formats:
- - *gztar*: gzip'ed tar-file
- - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.)
- - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available.)
- - *tar*: uncompressed tar file
- - *zip*: ZIP file
+ - *zip*: ZIP file (if the :mod:`zlib` module is available).
+ - *tar*: uncompressed tar file.
+ - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available).
+ - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available).
+ - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available).
You can register new formats or provide your own archiver for any existing
formats, by using :func:`register_archive_format`.
@@ -541,11 +543,12 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
*extract_dir* is the name of the target directory where the archive is
unpacked. If not provided, the current working directory is used.
- *format* is the archive format: one of "zip", "tar", or "gztar". Or any
- other format registered with :func:`register_unpack_format`. If not
- provided, :func:`unpack_archive` will use the archive file name extension
- and see if an unpacker was registered for that extension. In case none is
- found, a :exc:`ValueError` is raised.
+ *format* is the archive format: one of "zip", "tar", "gztar", "bztar", or
+ "xztar". Or any other format registered with
+ :func:`register_unpack_format`. If not provided, :func:`unpack_archive`
+ will use the archive file name extension and see if an unpacker was
+ registered for that extension. In case none is found,
+ a :exc:`ValueError` is raised.
.. function:: register_unpack_format(name, extensions, function[, extra_args[, description]])
@@ -578,11 +581,12 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
By default :mod:`shutil` provides these formats:
- - *gztar*: gzip'ed tar-file
- - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.)
- - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available.)
- - *tar*: uncompressed tar file
- - *zip*: ZIP file
+ - *zip*: ZIP file (unpacking compressed files works only if corresponding
+ module is available).
+ - *tar*: uncompressed tar file.
+ - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available).
+ - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available).
+ - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available).
You can register new formats or provide your own unpacker for any existing
formats, by using :func:`register_unpack_format`.