This fixes a regression from distutils, where “setup.py --help-commands”
prints out commands grouped by topic (i.e. building vs. installing),
which is more useful than using sorted.
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..)
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 will help scripts calling pysetup know if a command failed.
Printing/logging was also made more consistent, and a few things were
cleaned up. In particular, the error/Ctrl-C handling was moved from the
_run function up to the main function.
The run action is not fixed yet; it returns the dist.Distribution
instance, which is needed by test_uninstall and not trivial to fix.
“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.
This change also makes sure the logger handlers are not alterated after an
installation. That also fixes the remaining environment alteration issue in
test_packaging.