[Patches] [ python-Patches-1481112 ] Python long option support

SourceForge.net noreply at sourceforge.net
Wed Jul 12 15:20:41 CEST 2006


Patches item #1481112, was opened at 2006-05-03 13:59
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1481112&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.4
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Heiko Wundram (hwundram)
Assigned to: Martin v. Löwis (loewis)
Summary: Python long option support

Initial Comment:
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.

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-07-12 13:20

Message:
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.

----------------------------------------------------------------------

Comment By: Heiko Wundram (hwundram)
Date: 2006-05-04 20:21

Message:
Logged In: YES 
user_id=791932

Small extension to completely conform to Microsoft long-opt
semantics:

--<name>=<arg>

is equivalent to:

/<name>:<arg>

under Windows with the latest patch.

----------------------------------------------------------------------

Comment By: Heiko Wundram (hwundram)
Date: 2006-05-04 19:16

Message:
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 /<opt> support on Windows for long options,
and adds ? as a possible option to get help.

----------------------------------------------------------------------

Comment By: Heiko Wundram (hwundram)
Date: 2006-05-04 06:14

Message:
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...

----------------------------------------------------------------------

Comment By: Heiko Wundram (hwundram)
Date: 2006-05-04 06:06

Message:
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.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2006-05-04 04:56

Message:
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.

----------------------------------------------------------------------

Comment By: Heiko Wundram (hwundram)
Date: 2006-05-03 19:32

Message:
Logged In: YES 
user_id=791932

Final patch which should conform to PEP-7 completely.

----------------------------------------------------------------------

Comment By: Heiko Wundram (hwundram)
Date: 2006-05-03 18:59

Message:
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.

----------------------------------------------------------------------

Comment By: Georg Brandl (gbrandl)
Date: 2006-05-03 18:53

Message:
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.

----------------------------------------------------------------------

Comment By: Heiko Wundram (hwundram)
Date: 2006-05-03 18:37

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1481112&group_id=5470


More information about the Patches mailing list