[Python-checkins] cpython: Remove unneeded --all option of “pysetup list”.

eric.araujo python-checkins at python.org
Mon Sep 12 17:42:22 CEST 2011


http://hg.python.org/cpython/rev/df157cb96a99
changeset:   72356:df157cb96a99
user:        Éric Araujo <merwok at netwok.org>
date:        Mon Sep 12 16:45:38 2011 +0200
summary:
  Remove unneeded --all option of “pysetup list”.

The command without arguments already prints all installed distributions
found.

In addition, change “releases” for “projects” in the description of the
list action.  Strictly speaking, one installed distribution satisfies
the requirement for a release (i.e. version) of a project, but as
currently only one release per project can be installed at a time, the
two are somewhat equivalent, and “project” is more understandable in
help texts (which call their argument “dist”, by the way..)

files:
  Doc/install/pysetup.rst                          |  17 ++++----
  Lib/packaging/run.py                             |  20 ++++------
  Lib/packaging/tests/test_command_install_data.py |   1 +
  3 files changed, 18 insertions(+), 20 deletions(-)


diff --git a/Doc/install/pysetup.rst b/Doc/install/pysetup.rst
--- a/Doc/install/pysetup.rst
+++ b/Doc/install/pysetup.rst
@@ -19,13 +19,12 @@
 
 Pysetup makes it easy to find out what Python packages are installed::
 
-   $ pysetup search virtualenv
-   virtualenv 1.6 at /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info
+   $ pysetup list virtualenv
+   'virtualenv' 1.6 at '/opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info'
 
-   $ pysetup search --all
-   pyverify 0.8.1 at /opt/python3.3/lib/python3.3/site-packages/pyverify-0.8.1.dist-info
-   virtualenv 1.6 at /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info
-   wsgiref 0.1.2 at /opt/python3.3/lib/python3.3/wsgiref.egg-info
+   $ pysetup list
+   'pyverify' 0.8.1 at '/opt/python3.3/lib/python3.3/site-packages/pyverify-0.8.1.dist-info'
+   'virtualenv' 1.6 at '/opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info'
    ...
 
 
@@ -146,9 +145,11 @@
        metadata: Display the metadata of a project
        install: Install a project
        remove: Remove a project
-       search: Search for a project
+       search: Search for a project in the indexes
+       list: List installed projects
        graph: Display a graph
-       create: Create a Project
+       create: Create a project
+       generate-setup: Generate a backward-comptatible setup.py
 
    To get more help on an action, use:
 
diff --git a/Lib/packaging/run.py b/Lib/packaging/run.py
--- a/Lib/packaging/run.py
+++ b/Lib/packaging/run.py
@@ -290,27 +290,23 @@
 
 
 @action_help("""\
-Usage: pysetup list dist [dist ...]
+Usage: pysetup list [dist ...]
    or: pysetup list --help
-   or: pysetup list --all
 
 Print name, version and location for the matching installed distributions.
 
 positional arguments:
-   dist  installed distribution name
-
-optional arguments:
-   --all  list all installed distributions
+   dist  installed distribution name; omit to get all distributions
 """)
 def _list(dispatcher, args, **kw):
-    opts = _parse_args(args[1:], '', ['all'])
+    opts = _parse_args(args[1:], '', [])
     dists = get_distributions(use_egg_info=True)
-    if 'all' in opts or opts['args'] == []:
+    if opts['args']:
+        results = (d for d in dists if d.name.lower() in opts['args'])
+        listall = False
+    else:
         results = dists
         listall = True
-    else:
-        results = (d for d in dists if d.name.lower() in opts['args'])
-        listall = False
 
     number = 0
     for dist in results:
@@ -368,7 +364,7 @@
     ('install', 'Install a project', _install),
     ('remove', 'Remove a project', _remove),
     ('search', 'Search for a project in the indexes', _search),
-    ('list', 'List installed releases', _list),
+    ('list', 'List installed projects', _list),
     ('graph', 'Display a graph', _graph),
     ('create', 'Create a project', _create),
     ('generate-setup', 'Generate a backward-comptatible setup.py', _generate),
diff --git a/Lib/packaging/tests/test_command_install_data.py b/Lib/packaging/tests/test_command_install_data.py
--- a/Lib/packaging/tests/test_command_install_data.py
+++ b/Lib/packaging/tests/test_command_install_data.py
@@ -35,6 +35,7 @@
         two = os.path.join(pkg_dir, 'two')
         self.write_file(two, 'xxx')
 
+        # FIXME this creates a literal \{inst2\} directory!
         cmd.data_files = {one: '{inst}/one', two: '{inst2}/two'}
         self.assertCountEqual(cmd.get_inputs(), [one, two])
 

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


More information about the Python-checkins mailing list