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
7c4a3aa8
Commit
7c4a3aa8
authored
Oct 23, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
parent
3da0489b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
Lib/shutil.py
Lib/shutil.py
+4
-3
Lib/test/test_shutil.py
Lib/test/test_shutil.py
+13
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/shutil.py
View file @
7c4a3aa8
...
...
@@ -680,9 +680,10 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
with
zipfile
.
ZipFile
(
zip_filename
,
"w"
,
compression
=
zipfile
.
ZIP_DEFLATED
)
as
zf
:
path
=
os
.
path
.
normpath
(
base_dir
)
zf
.
write
(
path
,
path
)
if
logger
is
not
None
:
logger
.
info
(
"adding '%s'"
,
path
)
if
path
!=
os
.
curdir
:
zf
.
write
(
path
,
path
)
if
logger
is
not
None
:
logger
.
info
(
"adding '%s'"
,
path
)
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
base_dir
):
for
name
in
sorted
(
dirnames
):
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
dirpath
,
name
))
...
...
Lib/test/test_shutil.py
View file @
7c4a3aa8
...
...
@@ -1066,6 +1066,19 @@ class TestShutil(unittest.TestCase):
work_dir
=
os
.
path
.
dirname
(
tmpdir2
)
rel_base_name
=
os
.
path
.
join
(
os
.
path
.
basename
(
tmpdir2
),
'archive'
)
with
support
.
change_cwd
(
work_dir
):
base_name
=
os
.
path
.
abspath
(
rel_base_name
)
res
=
make_archive
(
rel_base_name
,
'zip'
,
root_dir
)
self
.
assertEqual
(
res
,
base_name
+
'.zip'
)
self
.
assertTrue
(
os
.
path
.
isfile
(
res
))
self
.
assertTrue
(
zipfile
.
is_zipfile
(
res
))
with
zipfile
.
ZipFile
(
res
)
as
zf
:
self
.
assertCountEqual
(
zf
.
namelist
(),
[
'dist/'
,
'dist/sub/'
,
'dist/sub2/'
,
'dist/file1'
,
'dist/file2'
,
'dist/sub/file3'
,
'outer'
])
with
support
.
change_cwd
(
work_dir
):
base_name
=
os
.
path
.
abspath
(
rel_base_name
)
res
=
make_archive
(
rel_base_name
,
'zip'
,
root_dir
,
base_dir
)
...
...
Misc/NEWS
View file @
7c4a3aa8
...
...
@@ -110,6 +110,8 @@ Core and Builtins
Library
-------
- Issue #28488: shutil.make_archive() no longer add entry "./" to ZIP archive.
- Issue #24452: Make webbrowser support Chrome on Mac OS X.
- Issue #20766: Fix references leaked by pdb in the handling of SIGINT
...
...
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