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: setup command alias erroneous for names with hyphens
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 05:33 by acue, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg356094 - (view) Author: Arno-Can Uestuensoez (acue) Date: 2019-11-06 05:33
Even though this involves 'setuptools', I write this issue here because of the tight coupling of 'distutils' and 'setuptools' e.g. by the passed 'self' parameter.

The aliases as represented by the command 'setup.py alias' are internally treated by 'setuptools' as options.

See code:

   setuptools.dist._parse_config_files()
   in Python-3.8.0:  line 604 - line 608

The consequence is the processing of the standard replacement of hyphens by underscores for alias names.

The resulting behaviour is here three folded.


1. The technical behaviour of the alias replacement for valid
   aliases id flawless.

2. The technical behaviour of the display representation for alias
   names containing a hyphen is erroneous.

   For example:

      python setup.py alias my-alias alias

   Results flawless in:

      [aliases]
      my-alias = alias

   The display:

      python setup.py alias

   is erroneous:

      (3.8.0)$ python setup.py alias
      running alias
      Command Aliases
      ---------------
      setup.py alias my_alias alias

   because the modified internal values are displayed - with replaced
   hyphens in alias names.


3. The call of the alias as command replacement is erroneous in general:

  3.0. the original call is flawless:

     (3.8.0)$ python setup.py alias

        running alias
        Command Aliases
        ---------------
        setup.py alias my_alias alias


  3.1. the call by defined literal alias is erroneous:

        (3.8.0)$ python setup.py my-alias

        invalid command name 'my-alias'

  3.2. the call by modified alias is also erroneous,
     as though the alias is not detected, resulting here in the
     display of an empty list:

        (3.8.0)$ python setup.py my_alias

        running alias
        Command Aliases
        ---------------


Another example to mention here is the acceptance of alias names including spaces, which prbably should be suppressed, because as far as I can see command name could not contain spaces at all.

E.g. the alias 'ls -l' is handeled erroneous in accordance to the previous remarks, but is basically not valid at all.

   (3.8.0)$ python setup.py 'ls -l' alias

Results in the flawless configuration entry:

   [aliases]
   ls -l = alias

The erroneous display:

    (3.8.0)$ python setup.py alias

    running alias
    Command Aliases
    ---------------
    setup.py alias ls _l alias

The behaviour should be fixed to be consistent to allow valid names and reject others. The accepted names should be fully functional, and displayed and made available for custom representation literally as provided by the user. A simple reverse-replacement is here not reliable.

The alternative of the caching of the original input is currently not possible for a simple public command API due to the lack of fully customization of the 'distclass' see issue Issue38711. Thus this seems currently to require a complete second scan including eventually selected user files as eventually selected by the provided call parameters.
msg356095 - (view) Author: Arno-Can Uestuensoez (acue) Date: 2019-11-06 05:38
Current related issues are:

issue 38714
issue 38711
issue 38709
msg386252 - (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: 82895
2021-02-03 18:07:48steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386252

resolution: out of date
stage: resolved
2019-11-06 05:38:13acuesetmessages: + msg356095
2019-11-06 05:33:52acuesettype: behavior
2019-11-06 05:33:35acuecreate