This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: query of global metadata options delivers error messages even when successful
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: acue, dstufft, eric.araujo, steve.dower
Priority: normal Keywords:

Created on 2019-11-06 12:07 by acue, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg356122 - (view) Author: Arno-Can Uestuensoez (acue) Date: 2019-11-06 12:07
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) $
msg386255 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:07
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:59:22adminsetgithub: 82899
2021-02-03 18:07:50steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386255

resolution: out of date
stage: resolved
2019-11-06 12:11:27acuesettitle: query of global options delivers error messages even when successful -> query of global metadata options delivers error messages even when successful
2019-11-06 12:07:59acuecreate