mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #22201: Command-line interface of the zipfile module now correctly
extracts ZIP files with directory entries. Patch by Ryan Wilson.
This commit is contained in:
parent
a64ce5d744
commit
97f17ff840
2 changed files with 4 additions and 12 deletions
|
|
@ -1764,18 +1764,7 @@ def main(args = None):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
with ZipFile(args[1], 'r') as zf:
|
with ZipFile(args[1], 'r') as zf:
|
||||||
out = args[2]
|
zf.extractall(args[2])
|
||||||
for path in zf.namelist():
|
|
||||||
if path.startswith('./'):
|
|
||||||
tgt = os.path.join(out, path[2:])
|
|
||||||
else:
|
|
||||||
tgt = os.path.join(out, path)
|
|
||||||
|
|
||||||
tgtdir = os.path.dirname(tgt)
|
|
||||||
if not os.path.exists(tgtdir):
|
|
||||||
os.makedirs(tgtdir)
|
|
||||||
with open(tgt, 'wb') as fp:
|
|
||||||
fp.write(zf.read(path))
|
|
||||||
|
|
||||||
elif args[0] == '-c':
|
elif args[0] == '-c':
|
||||||
if len(args) < 3:
|
if len(args) < 3:
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,9 @@ Windows
|
||||||
Tools/Demos
|
Tools/Demos
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
- Issue #22201: Command-line interface of the zipfile module now correctly
|
||||||
|
extracts ZIP files with directory entries. Patch by Ryan Wilson.
|
||||||
|
|
||||||
- Issue #21906: Make Tools/scripts/md5sum.py work in Python 3.
|
- Issue #21906: Make Tools/scripts/md5sum.py work in Python 3.
|
||||||
Patch by Zachary Ware.
|
Patch by Zachary Ware.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue