msg50180 - (view) |
Author: Heiko Wundram (hwundram) |
Date: 2006-05-03 13:59 |
The attached patch implements long option support for Python. It changes the optstring found in Modules/main.c, specifying brackets for the long name of a corresponding option name. The patch is backward compatible in that it doesn't change the behaviour of _PyOS_GetOpt for any old format string, except on [:()], which are explicitly excluded for matching an option. This shouldn't break any code, though. The patch is against Python 2.4.3. |
|
|
msg50181 - (view) |
Author: Heiko Wundram (hwundram) |
Date: 2006-05-03 18:37 |
Logged In: YES user_id=791932 The attached patch is against the current subversion trunk, and implements long options with possible arguments after an =-sign. It has partial matching for options, erroring out on ambiguous matches of the command line arguments. |
|
|
msg50182 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2006-05-03 18:53 |
Logged In: YES user_id=849994 Please update the patch to follow Python C style guidelines (PEP 7), especially use 8-space tabs to indent. Also, it might be good to send a copyright assignment to the PSF for a patch of this magnitude. Otherwise, I think that this is a desirable feature, at least for --help and --version. |
|
|
msg50183 - (view) |
Author: Heiko Wundram (hwundram) |
Date: 2006-05-03 18:59 |
Logged In: YES user_id=791932 I'll redo the patch with vim now, emacs doesn't like doing 8 spaces indents, at least as far as I can get it configured... Anyway, I assign the copyright to any code contained in this patch to the PSF. |
|
|
msg50184 - (view) |
Author: Heiko Wundram (hwundram) |
Date: 2006-05-03 19:32 |
Logged In: YES user_id=791932 Final patch which should conform to PEP-7 completely. |
|
|
msg50185 - (view) |
Author: Martin v. Löwis (loewis) *  |
Date: 2006-05-04 04:56 |
Logged In: YES user_id=21627 I actually wonder what the rationale for this patch is. The command line options of Python seem very clear to me; I don't see the need for long options. This should be discussed on python-dev. |
|
|
msg50186 - (view) |
Author: Heiko Wundram (hwundram) |
Date: 2006-05-04 06:06 |
Logged In: YES user_id=791932 The rationale behind this patch is to enable python to answer to --version and --help, which are pretty much standard command-line options with GNU utilities, and increasingly common amongst BSD utilities. I developed this patch, answering to a request on c.l.p where people were asking for Python to answer to --version, and thought I could generalize it a bit so that long options can also be used for other arguments. |
|
|
msg50187 - (view) |
Author: Heiko Wundram (hwundram) |
Date: 2006-05-04 06:14 |
Logged In: YES user_id=791932 I just posted a mail to python-dev explaining my rationale behind this patch. Maybe you could answer there... |
|
|
msg50188 - (view) |
Author: Heiko Wundram (hwundram) |
Date: 2006-05-04 19:16 |
Logged In: YES user_id=791932 The latest patch takes into account all constructive ideas that have been proposed on python-dev for this enhancement. It implements / support on Windows for long options, and adds ? as a possible option to get help. |
|
|
msg50189 - (view) |
Author: Heiko Wundram (hwundram) |
Date: 2006-05-04 20:21 |
Logged In: YES user_id=791932 Small extension to completely conform to Microsoft long-opt semantics: --= is equivalent to: /: under Windows with the latest patch. |
|
|
msg50190 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2006-07-12 13:20 |
Logged In: YES user_id=849994 Rejecting as per python-dev discussion. There was a pronouncement from Guido that only --help, --version and /? for Win should be added. |
|
|