[Distutils] Wheels and console script entry point wrappers (Was: Replacing pip.exe with a Python script)

Paul Moore p.f.moore at gmail.com
Tue Jul 16 17:22:16 CEST 2013


On 16 July 2013 16:09, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:

> If you only want the program to be invokable from cmd and PowerShell*
> then a .bat file should be fine. Depending on file extension to invoke
> .py files with py.exe is subject to input/output redirection bugs on
> some windows systems (this is solveable when using .py in PATHEXT
> instead of file associations for cmd at least).
>

bat files have many, many problems. The worst ones are:

* Not nestable. If pip is a bat file, saying "pip install foo" from within
another bat file will fail silently (control never returns to the line
after the pip command).
* If you interrupt them you get the obnoxious "Do you want to terminate the
batch file?" prompt.

If anyone suggests using bat files, I'll cry :-)

However, if you also want the program name to be invokable from e.g.
> subprocess with shell=False or from git-bash or Cygwin or many other
> things then neither .bat files nor PATHEXT are sufficient. Wrapper
> .exes are necessary to ensure that this works properly.
>

Yes. I have been convinced that ultimately, wrapper exes are the only
"transparent" means of writing command-line applications on Windows.

Because of this, I'd quite like it if wrapper functionality were added to
the py launcher (most of the functionality is already present, it would
probably be a pretty small change) so that we had a "one obvious way" of
writing wrappers. I may try to put together a patch for CPython to this
effect...

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130716/572874eb/attachment-0001.html>


More information about the Distutils-SIG mailing list