Print all fields when calling “pysetup metadata” without options.
When called without option (“-f field” or “--all”), “pysetup metadata” didn’t do anything useful. Now it prints out all metadata fields. The “--all” option is removed.
This commit is contained in:
parent
b741313ca8
commit
fb639295ac
@ -76,7 +76,7 @@ argument. ::
|
||||
Name:
|
||||
virtualenv
|
||||
|
||||
$ pysetup metadata virtualenv --all
|
||||
$ pysetup metadata virtualenv
|
||||
Metadata-Version:
|
||||
1.0
|
||||
Name:
|
||||
|
@ -71,8 +71,8 @@ positional arguments:
|
||||
"""
|
||||
|
||||
metadata_usage = """\
|
||||
Usage: pysetup metadata [dist] [-f field ...]
|
||||
or: pysetup metadata [dist] [--all]
|
||||
Usage: pysetup metadata [dist]
|
||||
or: pysetup metadata [dist] [-f field ...]
|
||||
or: pysetup metadata --help
|
||||
|
||||
Print metadata for the distribution.
|
||||
@ -81,8 +81,7 @@ positional arguments:
|
||||
dist installed distribution name
|
||||
|
||||
optional arguments:
|
||||
-f metadata field to print
|
||||
--all print all metadata fields
|
||||
-f metadata field to print; omit to get all fields
|
||||
"""
|
||||
|
||||
remove_usage = """\
|
||||
@ -252,7 +251,7 @@ def _install(dispatcher, args, **kw):
|
||||
|
||||
@action_help(metadata_usage)
|
||||
def _metadata(dispatcher, args, **kw):
|
||||
opts = _parse_args(args[1:], 'f:', ['all'])
|
||||
opts = _parse_args(args[1:], 'f:', [])
|
||||
if opts['args']:
|
||||
name = opts['args'][0]
|
||||
dist = get_distribution(name, use_egg_info=True)
|
||||
@ -269,13 +268,10 @@ def _metadata(dispatcher, args, **kw):
|
||||
|
||||
metadata = dist.metadata
|
||||
|
||||
if 'all' in opts:
|
||||
keys = metadata.keys()
|
||||
if 'f' in opts:
|
||||
keys = (k for k in opts['f'] if k in metadata)
|
||||
else:
|
||||
if 'f' in opts:
|
||||
keys = (k for k in opts['f'] if k in metadata)
|
||||
else:
|
||||
keys = ()
|
||||
keys = metadata.keys()
|
||||
|
||||
for key in keys:
|
||||
if key in metadata:
|
||||
|
Loading…
x
Reference in New Issue
Block a user