The 'setup.py' interface offers some global options, which could be queried. For example among numerous others the 'classifiers'.
The current implementation displays for example for the following call::
python setup.py --description
The result::
(3.8.0) $ python setup.py --description
<description-text>
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
(3.8.0) $ echo $?
1
(3.8.0) $
I would like to propose some minor enhancements here.
1. The error message is here an error itself, because the
query was flawless successful.
This is due to the implementation by relying on an
exception for the termination condition, when no
command was given. This is for the global query options
for the global metadata perfectly allright.
Thus the error message must not occur.
2. The resulting exit code of '1' is due to the same execption
for the missing command.
Thus the exit code must be '0' on Posix based and alike
systems.
3. The usage message, which is also based on a private method,
is basically an error itself. This is due to the fact, that
actually nothing has failed.
Thus the usage message must not be displayed here.
4. I also would like to propose some layout enhancements at
this occasion.
The value of the queried attribute - here the description,
should be separated by a <CR>.
E.g. by 'USAGE', or 'global_+usage()' within 'distutils.core'.
The resulting layout and exit value would be:
(3.8.0) $ python setup.py --description
<description-text>
(3.8.0) $ echo $?
0
(3.8.0) $
|