mirror of https://github.com/python/cpython
Issue #28102: The zipfile module CLI now prints usage to stderr.
Patch by Stephen J. Turnbull.
This commit is contained in:
parent
b12881e821
commit
2f76b5694d
|
@ -1963,19 +1963,19 @@ def main(args = None):
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
|
|
||||||
if not args or args[0] not in ('-l', '-c', '-e', '-t'):
|
if not args or args[0] not in ('-l', '-c', '-e', '-t'):
|
||||||
print(USAGE)
|
print(USAGE, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args[0] == '-l':
|
if args[0] == '-l':
|
||||||
if len(args) != 2:
|
if len(args) != 2:
|
||||||
print(USAGE)
|
print(USAGE, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
with ZipFile(args[1], 'r') as zf:
|
with ZipFile(args[1], 'r') as zf:
|
||||||
zf.printdir()
|
zf.printdir()
|
||||||
|
|
||||||
elif args[0] == '-t':
|
elif args[0] == '-t':
|
||||||
if len(args) != 2:
|
if len(args) != 2:
|
||||||
print(USAGE)
|
print(USAGE, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
with ZipFile(args[1], 'r') as zf:
|
with ZipFile(args[1], 'r') as zf:
|
||||||
badfile = zf.testzip()
|
badfile = zf.testzip()
|
||||||
|
@ -1985,7 +1985,7 @@ def main(args = None):
|
||||||
|
|
||||||
elif args[0] == '-e':
|
elif args[0] == '-e':
|
||||||
if len(args) != 3:
|
if len(args) != 3:
|
||||||
print(USAGE)
|
print(USAGE, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
with ZipFile(args[1], 'r') as zf:
|
with ZipFile(args[1], 'r') as zf:
|
||||||
|
@ -1993,7 +1993,7 @@ def main(args = None):
|
||||||
|
|
||||||
elif args[0] == '-c':
|
elif args[0] == '-c':
|
||||||
if len(args) < 3:
|
if len(args) < 3:
|
||||||
print(USAGE)
|
print(USAGE, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def addToZip(zf, path, zippath):
|
def addToZip(zf, path, zippath):
|
||||||
|
|
|
@ -13,6 +13,12 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
Tools/Demos
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- Issue #28102: The zipfile module CLI now prints usage to stderr.
|
||||||
|
Patch by Stephen J. Turnbull.
|
||||||
|
|
||||||
|
|
||||||
What's New in Python 3.6.0 beta 1
|
What's New in Python 3.6.0 beta 1
|
||||||
=================================
|
=================================
|
||||||
|
|
Loading…
Reference in New Issue