Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9a4fc195
Commit
9a4fc195
authored
Nov 28, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21280: Fixed a bug in shutil.make_archive() when create an archive of
current directory in current directory.
parent
ab5e9b92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
Lib/shutil.py
Lib/shutil.py
+2
-2
Lib/test/test_shutil.py
Lib/test/test_shutil.py
+15
-0
No files found.
Lib/shutil.py
View file @
9a4fc195
...
...
@@ -600,7 +600,7 @@ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
archive_name
=
base_name
+
'.tar'
+
compress_ext
.
get
(
compress
,
''
)
archive_dir
=
os
.
path
.
dirname
(
archive_name
)
if
not
os
.
path
.
exists
(
archive_dir
):
if
archive_dir
and
not
os
.
path
.
exists
(
archive_dir
):
if
logger
is
not
None
:
logger
.
info
(
"creating %s"
,
archive_dir
)
if
not
dry_run
:
...
...
@@ -660,7 +660,7 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
zip_filename
=
base_name
+
".zip"
archive_dir
=
os
.
path
.
dirname
(
base_name
)
if
not
os
.
path
.
exists
(
archive_dir
):
if
archive_dir
and
not
os
.
path
.
exists
(
archive_dir
):
if
logger
is
not
None
:
logger
.
info
(
"creating %s"
,
archive_dir
)
if
not
dry_run
:
...
...
Lib/test/test_shutil.py
View file @
9a4fc195
...
...
@@ -1126,6 +1126,21 @@ class TestShutil(unittest.TestCase):
finally
:
unregister_archive_format
(
'xxx'
)
def
test_make_tarfile_in_curdir
(
self
):
# Issue #21280
root_dir
=
self
.
mkdtemp
()
with
support
.
change_cwd
(
root_dir
):
self
.
assertEqual
(
make_archive
(
'test'
,
'tar'
),
'test.tar'
)
self
.
assertTrue
(
os
.
path
.
isfile
(
'test.tar'
))
@
requires_zlib
def
test_make_zipfile_in_curdir
(
self
):
# Issue #21280
root_dir
=
self
.
mkdtemp
()
with
support
.
change_cwd
(
root_dir
):
self
.
assertEqual
(
make_archive
(
'test'
,
'zip'
),
'test.zip'
)
self
.
assertTrue
(
os
.
path
.
isfile
(
'test.zip'
))
def
test_register_archive_format
(
self
):
self
.
assertRaises
(
TypeError
,
register_archive_format
,
'xxx'
,
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment