[Python-checkins] cpython: Print all fields when calling “pysetup metadata” without options.

eric.araujo python-checkins at python.org
Tue Aug 30 16:22:12 CEST 2011


http://hg.python.org/cpython/rev/c1067f8b1df7
changeset:   72125:c1067f8b1df7
user:        Éric Araujo <merwok at netwok.org>
date:        Mon Aug 29 22:03:46 2011 +0200
summary:
  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.

files:
  Doc/install/pysetup.rst |   2 +-
  Lib/packaging/run.py    |  18 +++++++-----------
  2 files changed, 8 insertions(+), 12 deletions(-)


diff --git a/Doc/install/pysetup.rst b/Doc/install/pysetup.rst
--- a/Doc/install/pysetup.rst
+++ b/Doc/install/pysetup.rst
@@ -76,7 +76,7 @@
    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
--- a/Lib/packaging/run.py
+++ b/Lib/packaging/run.py
@@ -71,8 +71,8 @@
 """
 
 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 @@
    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 @@
 
 @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 @@
 
     metadata = dist.metadata
 
-    if 'all' in opts:
+    if 'f' in opts:
+        keys = (k for k in opts['f'] if k in metadata)
+    else:
         keys = metadata.keys()
-    else:
-        if 'f' in opts:
-            keys = (k for k in opts['f'] if k in metadata)
-        else:
-            keys = ()
 
     for key in keys:
         if key in metadata:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list