8000 gh-74696: Do not change the current working directory in shutil.make_archive() if possible by serhiy-storchaka · Pull Request #93160 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-74696: Do not change the current working directory in shutil.make_archive() if possible #93160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add comments for _ARCHIVE_FORMATS and _UNPACK_FORMATS.
  • Loading branch information
serhiy-storchaka committed May 24, 2022
commit 21cd33d4917456cf53b315ba6651d8c6970bc6a6
10 changes: 10 additions & 0 deletions Lib/shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,11 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0,
zip_filename = os.path.abspath(zip_filename)
return zip_filename

# Maps the name of the archive format to a tuple containing:
# * the archiving function
# * extra keyword arguments
# * description
# * does it support the root_dir argument?
_ARCHIVE_FORMATS = {
'tar': (_make_tarball, [('compress', None)],
"uncompressed tar file", True),
Expand Down Expand Up @@ -1238,6 +1243,11 @@ def _unpack_tarfile(filename, extract_dir):
finally:
tarobj.close()

# Maps the name of the archive format to a tuple containing:
# * extensions
# * the unpacking function
# * extra keyword arguments
# * description
_UNPACK_FORMATS = {
'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"),
'zip': (['.zip'], _unpack_zipfile, [], "ZIP file"),
Expand Down
0