[New-bugs-announce] [issue38714] setup command alias erroneous for names with hyphens

Arno-Can Uestuensoez report at bugs.python.org
Wed Nov 6 00:33:35 EST 2019


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

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.

----------
components: Distutils
messages: 356094
nosy: acue, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: setup command alias erroneous for names with hyphens
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/issue38714>
_______________________________________


More information about the New-bugs-announce mailing list