mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
gh-74696: Pass root_dir to custom archivers which support it (GH-94251)
Co-authored-by: Éric <merwok@netwok.org>
This commit is contained in:
parent
4b83cd0b22
commit
e3ef400be7
5 changed files with 77 additions and 17 deletions
|
@ -575,9 +575,10 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
|
|||
.. note::
|
||||
|
||||
This function is not thread-safe when custom archivers registered
|
||||
with :func:`register_archive_format` are used. In this case it
|
||||
with :func:`register_archive_format` do not support the *root_dir*
|
||||
argument. In this case it
|
||||
temporarily changes the current working directory of the process
|
||||
to perform archiving.
|
||||
to *root_dir* to perform archiving.
|
||||
|
||||
.. versionchanged:: 3.8
|
||||
The modern pax (POSIX.1-2001) format is now used instead of
|
||||
|
@ -614,12 +615,21 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
|
|||
Further arguments are passed as keyword arguments: *owner*, *group*,
|
||||
*dry_run* and *logger* (as passed in :func:`make_archive`).
|
||||
|
||||
If *function* has the custom attribute ``function.supports_root_dir`` set to ``True``,
|
||||
the *root_dir* argument is passed as a keyword argument.
|
||||
Otherwise the current working directory of the process is temporarily
|
||||
changed to *root_dir* before calling *function*.
|
||||
In this case :func:`make_archive` is not thread-safe.
|
||||
|
||||
If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be
|
||||
used as extra keywords arguments when the archiver callable is used.
|
||||
|
||||
*description* is used by :func:`get_archive_formats` which returns the
|
||||
list of archivers. Defaults to an empty string.
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
Added support for functions supporting the *root_dir* argument.
|
||||
|
||||
|
||||
.. function:: unregister_archive_format(name)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue