
I've found a bug with cli.exe and a missing feature. The bug is that arguments containing embedded spaces aren't handled correctly. For example, suppose you have foo-script.py and a copy of cli.exe named foo.exe. If you call foo.exe with a single argument, like this: foo "a b" then foo-script.py will be called with 2 arguments, "a", and "b", rather than a single argument, "a b". The missing feature is that options on the #! line aren't honored. It would be nice if, for example, a script beginning like: #!\Python24\python.exe -O would run Python in optimized mode. I'd be happy to take a crack at fixing the bug and adding the feature. Where is the source? I assume that this also applies to gui.exe. BTW, Shouldn't the setuptools project be moved out of sandbox and be made a proper svn project with it's own trunk, branches, and tags? Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org

At 04:32 PM 8/21/2006 -0400, Jim Fulton wrote:
I've found a bug with cli.exe and a missing feature.
The bug is that arguments containing embedded spaces aren't handled correctly. For example, suppose you have foo-script.py and a copy of cli.exe named foo.exe. If you call foo.exe with a single argument, like this:
foo "a b"
then foo-script.py will be called with 2 arguments, "a", and "b", rather than a single argument, "a b".
The missing feature is that options on the #! line aren't honored. It would be nice if, for example, a script beginning like:
#!\Python24\python.exe -O
would run Python in optimized mode.
I'd be happy to take a crack at fixing the bug and adding the feature.
Thanks! Please watch out for making sure that the following are still supported after your changes: * Non-ASCII paths to python.exe * Embedded spaces in the path to python.exe
Where is the source?
launcher.c in the root of the setuptools checkout.
I assume that this also applies to gui.exe.
Yes; both are compiled from the same source.
BTW, Shouldn't the setuptools project be moved out of sandbox and be made a proper svn project with it's own trunk, branches, and tags?
Dunno; setuptools' presence in the sandbox predates the use of SVN for Python. In any case, I'm more than happy with the status quo. Note that there is also a branch for 0.6 maintenance in sandbox/branches.

Phillip, I'v updated launcher.c, cli.exe, and gui.exe on the jim-fix- setuptools-cli branch. I've also added a doctest for cli.exe. The update: - Causes script arguments to be quoted with correct handling of embedded double quotes. This allows passing arguments with embedded spaces and double quotes to scripts. - Added support for passing a single argument (possibly specifying multiple options) to the Python executable on the #! line. - Fixed a bug in handling trailing spaces on the #! line. Let me know if you'd like me to merge this to the 0.6 branch and trunk. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org

At 02:56 PM 8/22/2006 -0400, Jim Fulton wrote:
Phillip,
I'v updated launcher.c, cli.exe, and gui.exe on the jim-fix- setuptools-cli branch. I've also added a doctest for cli.exe.
The update:
- Causes script arguments to be quoted with correct handling of embedded double quotes. This allows passing arguments with embedded spaces and double quotes to scripts.
- Added support for passing a single argument (possibly specifying multiple options) to the Python executable on the #! line.
- Fixed a bug in handling trailing spaces on the #! line.
Fantastic, thank you very much!
Let me know if you'd like me to merge this to the 0.6 branch and trunk.
Yes, please. I'll take care of updating the release notes for 0.6c2. By the way, just for future reference, you don't need to branch the entire sandbox to work on a setuptools branch. Notice, for example, that the setuptools-0.6 branch is just a copy of the sandbox/setuptools directory. This is in fact the standard way to do branches and tags in the Python sandbox (i.e., just branch or tag the individual project, not the entire sandbox).

On Aug 22, 2006, at 3:21 PM, Phillip J. Eby wrote:
Let me know if you'd like me to merge this to the 0.6 branch and trunk.
Yes, please. I'll take care of updating the release notes for 0.6c2.
Done. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org
participants (2)
-
Jim Fulton
-
Phillip J. Eby