classification
Title: Don't print traceback for unrecognized actions, commands and options in packaging
Type: Stage: resolved
Components: Distutils2 Versions: Python 3.3, 3rd party
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Arfrever, alexis, eric.araujo, python-dev, tarek
Priority: normal Keywords: easy

Created on 2011-11-14 14:34 by Arfrever, last changed 2014-03-12 10:16 by eric.araujo. This issue is now closed.

Messages (5)
msg147599 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * Date: 2011-11-14 14:34
$ python3.3 setup.py build --some-option
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: option --some-option not recognized
$ pysetup3.3 run build --some-option
option --some-option not recognized
Traceback (most recent call last):
  File "/usr/lib64/python3.3/packaging/fancy_getopt.py", line 239, in getopt
    opts, args = getopt.getopt(args, short_opts, self.long_opts)
  File "/usr/lib64/python3.3/getopt.py", line 93, in getopt
    opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
  File "/usr/lib64/python3.3/getopt.py", line 157, in do_longs
    has_arg, opt = long_has_args(opt, longopts)
  File "/usr/lib64/python3.3/getopt.py", line 174, in long_has_args
    raise GetoptError(_('option --%s not recognized') % opt, opt)
getopt.GetoptError: option --some-option not recognized

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.3/packaging/run.py", line 653, in main
    return dispatcher()
  File "/usr/lib64/python3.3/packaging/run.py", line 642, in __call__
    return func(self, self.args)
  File "/usr/lib64/python3.3/packaging/run.py", line 91, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib64/python3.3/packaging/run.py", line 271, in _run
    args = dispatcher._parse_command_opts(parser, args)
  File "/usr/lib64/python3.3/packaging/run.py", line 491, in _parse_command_opts
    args, opts = parser.getopt(args[1:])
  File "/usr/lib64/python3.3/packaging/fancy_getopt.py", line 241, in getopt
    raise PackagingArgError(msg)
packaging.errors.PackagingArgError: option --some-option not recognized
msg147601 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * Date: 2011-11-14 14:48
$ pysetup3.3 unknown_action
Unrecognized action "unknown_action"
Traceback (most recent call last):
  File "/usr/lib64/python3.3/packaging/run.py", line 650, in main
    dispatcher = Dispatcher(args)
  File "/usr/lib64/python3.3/packaging/run.py", line 404, in __init__
    raise PackagingArgError(msg)
packaging.errors.PackagingArgError: Unrecognized action "unknown_action"
$ pysetup3.3 run unknown_command
Invalid command unknown_command
Traceback (most recent call last):
  File "/usr/lib64/python3.3/packaging/command/__init__.py", line 57, in get_command_class
    cls = _COMMANDS[name]
KeyError: 'unknown_command'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.3/packaging/run.py", line 448, in _parse_command_opts
    cmd_class = get_command_class(command)
  File "/usr/lib64/python3.3/packaging/command/__init__.py", line 59, in get_command_class
    raise PackagingModuleError("Invalid command %s" % name)
packaging.errors.PackagingModuleError: Invalid command unknown_command

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.3/packaging/run.py", line 653, in main
    return dispatcher()
  File "/usr/lib64/python3.3/packaging/run.py", line 642, in __call__
    return func(self, self.args)
  File "/usr/lib64/python3.3/packaging/run.py", line 91, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib64/python3.3/packaging/run.py", line 271, in _run
    args = dispatcher._parse_command_opts(parser, args)
  File "/usr/lib64/python3.3/packaging/run.py", line 450, in _parse_command_opts
    raise PackagingArgError(msg)
packaging.errors.PackagingArgError: Invalid command unknown_command
msg160801 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-16 05:07
New changeset 478700dd4f6c by Patrice Gauthier in branch 'default':
#13399: Fixes the invalid arguments handling
http://hg.python.org/distutils2/rev/478700dd4f6c

New changeset fcfa635db609 by Patrice Gauthier in branch 'default':
#13399 - some tweaking
http://hg.python.org/distutils2/rev/fcfa635db609
msg160894 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-05-16 17:49
91ac9c36f09e is also related to this.

pysetup --unknown-option silently does nothing and exits with 0.
msg161292 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-21 19:56
New changeset 7d4098ce0087 by Éric Araujo in branch 'default':
Tighten tests for #13399
http://hg.python.org/distutils2/rev/7d4098ce0087
History
Date User Action Args
2014-03-12 10:16:23eric.araujosetstatus: open -> closed
resolution: out of date
stage: resolved
2012-05-23 14:39:21eric.araujolinkissue14887 superseder
2012-05-21 19:56:03python-devsetmessages: + msg161292
2012-05-16 17:49:48eric.araujosetassignee: tarek -> eric.araujo
messages: + msg160894
versions: + 3rd party
2012-05-16 05:07:28python-devsetnosy: + python-dev
messages: + msg160801
2011-11-14 14:48:16Arfreversetmessages: + msg147601
title: Don't print traceback for unrecognized options in packaging -> Don't print traceback for unrecognized actions, commands and options in packaging
2011-11-14 14:35:30Arfreversettitle: Don't print traceback for recognized options in packaging -> Don't print traceback for unrecognized options in packaging
2011-11-14 14:34:27Arfrevercreate