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
52313d72
Commit
52313d72
authored
Oct 04, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #22219: The zipfile module CLI now adds entries for directories
(including empty directories) in ZIP file.
parent
c6cf35d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
Lib/zipfile.py
Lib/zipfile.py
+9
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/zipfile.py
View file @
52313d72
...
...
@@ -1519,14 +1519,21 @@ def main(args = None):
if
os
.
path
.
isfile
(
path
):
zf
.
write
(
path
,
zippath
,
ZIP_DEFLATED
)
elif
os
.
path
.
isdir
(
path
):
if
zippath
:
zf
.
write
(
path
,
zippath
)
for
nm
in
os
.
listdir
(
path
):
addToZip
(
zf
,
os
.
path
.
join
(
path
,
nm
),
os
.
path
.
join
(
zippath
,
nm
))
# else: ignore
with
ZipFile
(
args
[
1
],
'w'
,
allowZip64
=
True
)
as
zf
:
for
src
in
args
[
2
:]:
addToZip
(
zf
,
src
,
os
.
path
.
basename
(
src
))
for
path
in
args
[
2
:]:
zippath
=
os
.
path
.
basename
(
path
)
if
not
zippath
:
zippath
=
os
.
path
.
basename
(
os
.
path
.
dirname
(
path
))
if
zippath
in
(
''
,
os
.
curdir
,
os
.
pardir
):
zippath
=
''
addToZip
(
zf
,
path
,
zippath
)
if
__name__
==
"__main__"
:
main
()
Misc/NEWS
View file @
52313d72
...
...
@@ -31,6 +31,9 @@ Core and Builtins
Library
-------
-
Issue
#
22219
:
The
zipfile
module
CLI
now
adds
entries
for
directories
(
including
empty
directories
)
in
ZIP
file
.
-
Issue
#
22449
:
In
the
ssl
.
SSLContext
.
load_default_certs
,
consult
the
enviromental
variables
SSL_CERT_DIR
and
SSL_CERT_FILE
on
Windows
.
...
...
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