[New-bugs-announce] [issue38718] query of global options delivers error messages even when successful

Arno-Can Uestuensoez report at bugs.python.org
Wed Nov 6 07:07:59 EST 2019


New submission from Arno-Can Uestuensoez <acue.opensource at gmail.com>:

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) $

----------
components: Distutils
messages: 356122
nosy: acue, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: query of global options delivers error messages even when successful
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38718>
_______________________________________


More information about the New-bugs-announce mailing list