[Python-Dev] Python long command line options (original) (raw)
Heiko Wundram me+python-dev at modelnine.org
Thu May 4 21:25:49 CEST 2006
- Previous message: [Python-Dev] Python long command line options
- Next message: [Python-Dev] Python long command line options
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am Donnerstag 04 Mai 2006 16:21 schrieb Fredrik Lundh:
I'm +1 on adding --help and --version, +1 on adding -? and /? for windows only, -0=slightly sceptical if adding a generic long option machinery is worth it, and -1 on a guessing machinery.
I've updated the patch on the SourceForge tracker to reflect this criticism. In effect:
- --help and --version are added unconditionally on all platforms
- -? and /? are recognized on Windows, as are /help and /version, because / is just a different longopt-specifier on Windows for the getopt machinery in _PyOS_GetOpt
- I removed the prefix matching
- I removed the last reference to a string function in _PyOS_GetOpt
- --command, which was a test-case for me, has been removed as a long-opt again.
The module has undergone a complete rewrite with this patch, and I've adapted the module header to reflect this (because there's absolutely no legacy code left now, which can be seen pretty clearly when you look at a diff...). The usage output in Modules/main.c has also been adapted, as have the test cases in test_cmd_line.py for usage and version, which pass cleanly for me.
The patch doesn't produce any warnings on gcc 3.4.6, and I've tested the Windows-specific additions to _PyOS_GetOpt by injecting MS_WINDOWS into the compilation on my system for Python/getopt.c, and it produces correct results on /?, /version, /help, and -?, but as I said before I can't tell whether there are bugs left which surface when it's being compiled on Windows directly, as I don't have a Windows system to test this patch on.
Anyway, would be glad to hear any feedback.
--- Heiko.
- Previous message: [Python-Dev] Python long command line options
- Next message: [Python-Dev] Python long command line options
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]