diff options
author | Éric Araujo <merwok@netwok.org> | 2011-08-29 20:03:46 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-08-29 20:03:46 (GMT) |
commit | fb639295ac48ba22d89a12f0368c1877f3035bbe (patch) | |
tree | 3dd696f68d4ea4aa1f457a9b2099d23e035f14fd | |
parent | b741313ca80bad9f173a15ba6a1a1a28326ab5ce (diff) | |
download | cpython-fb639295ac48ba22d89a12f0368c1877f3035bbe.zip cpython-fb639295ac48ba22d89a12f0368c1877f3035bbe.tar.gz cpython-fb639295ac48ba22d89a12f0368c1877f3035bbe.tar.bz2 |
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.
-rw-r--r-- | Doc/install/pysetup.rst | 2 | ||||
-rw-r--r-- | Lib/packaging/run.py | 18 |
2 files changed, 8 insertions, 12 deletions
diff --git a/Doc/install/pysetup.rst b/Doc/install/pysetup.rst index b88c8e1..08ba08e 100644 --- a/Doc/install/pysetup.rst +++ b/Doc/install/pysetup.rst @@ -76,7 +76,7 @@ argument. :: Name: virtualenv - $ pysetup metadata virtualenv --all + $ pysetup metadata virtualenv Metadata-Version: 1.0 Name: diff --git a/Lib/packaging/run.py b/Lib/packaging/run.py index 8e117ed..5b33583 100644 --- a/Lib/packaging/run.py +++ b/Lib/packaging/run.py @@ -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: |