classification
Title: Rewrite the command line parsers and actions system used in distutils2
Type: enhancement 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: alexis, eric.araujo, jkloth, michael.mulich, tarek, tshepang
Priority: normal Keywords:

Created on 2012-05-21 19:21 by eric.araujo, last changed 2014-03-13 00:57 by eric.araujo. This issue is now closed.

Messages (1)
msg161289 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-05-21 19:21
At present distutils2/packaging uses many command line parsers:

- one parser for commands and their options implemented in the dist.Distribution class, inherited from distutils and based on fanncy_getopt;

- another parser for pysetup actions and options implemented in run.Dispatcher, also using fancy_getopt;

- a _parse_args function based on getopt (le gasp!) and used by the functions implementing pysetup actions.

This causes no end of bugs and maintenance issues.  The actions system could also be much improved; one issue is that the option parsing is not automated (unlike for commands) and the loading of actions is not lazy.  See https://groups.google.com/forum/#!topic/the-fellowship-of-the-packaging/pxOZ_j4_4yg for details.

My current inclination is to just use argparse everywhere, with a thin wrapper to preserve the current way to declare commands options, and something similar for actions.  Backporting argparse for 2.5, 2.6 and 3.1 won’t be hard and using it should buy us much.  The key thing is that the various subparsers (e.g. for pysetup, for the run action, for one command) should work together lazily: the pysetup parser should parse its options and stop at the 'run' segment, then pass on to the run action parser, etc.  The goal is to avoid creating all the parsers for actions and commands.
History
Date User Action Args
2014-03-13 00:57:39eric.araujosetstatus: open -> closed
resolution: out of date
stage: needs patch -> resolved
2012-05-25 16:33:05tshepangsetnosy: + tshepang
2012-05-21 19:23:11eric.araujolinkissue12937 dependencies
2012-05-21 19:21:33eric.araujocreate