diff options
author | Éric Araujo <merwok@netwok.org> | 2011-07-29 00:20:39 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-07-29 00:20:39 (GMT) |
commit | 73c175f5a0a7e749357e74f518c89b716b7e34b2 (patch) | |
tree | b83ac5c6fdf186279e42b22a88aa30179eee8c08 /Lib | |
parent | 2527796a22404d5b8cb0e498a965c6b4a743caac (diff) | |
download | cpython-73c175f5a0a7e749357e74f518c89b716b7e34b2.zip cpython-73c175f5a0a7e749357e74f518c89b716b7e34b2.tar.gz cpython-73c175f5a0a7e749357e74f518c89b716b7e34b2.tar.bz2 |
Let pysetup list exit with a non-zero code when no result is found (#11409).
“pysetup list” or “pysetup list --all” will continue to return 0 if no
distribution is found (it’s not an error), but “pysetup list
some.project” will now exit with 1 if no matching installed distribution
is found. Based on a patch by Kelsey Hightower.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/packaging/run.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/packaging/run.py b/Lib/packaging/run.py index 3e720cf..bcc3c21 100644 --- a/Lib/packaging/run.py +++ b/Lib/packaging/run.py @@ -358,8 +358,10 @@ def _list(dispatcher, args, **kw): dists = get_distributions(use_egg_info=True) if 'all' in opts or opts['args'] == []: 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 +370,11 @@ def _list(dispatcher, args, **kw): print() if number == 0: - print('Nothing seems to be installed.') + if listall: + print('Nothing seems to be installed.') + else: + print('No matching distribution found.') + return 1 else: print('Found %d projects installed.' % number) |