[Distutils] Replacing pip.exe with a Python script

Paul Moore p.f.moore at gmail.com
Mon Jul 15 20:23:37 CEST 2013


On 15 July 2013 18:26, Donald Stufft <donald at stufft.io> wrote:

> Maybe this is a crazy idea, but would a windows only extension work?
> .pye(executable) Then just associate .pye with the launcher. Python won't
> see .pye as importable so there's no shadow issues.


That's actually a very good idea. The only downside is the proliferation of
extensions involved, and the need to register them. That puts it into the
territory of things the installer needs to do if we're to be able to assume
it. But I may propose it to python-dev (Daniel proposed a "zipped Python
app" extension a while back, as well. I'm not sure what happened with that
one...)

Actually, this and many of the other ideas fall foul of backward
compatibility issues - we can't assume the Python launcher is available
prior to Python 3.3, so #! support in .py files isn't available either.

I think I'm coming to the conclusion that the best way forward is:
1. Continue using the setuptools exe launcher, but bundle our own copy.
2. Modify setup.py to install our own scripts run via the exe launcher,
which don't rely on entry points and pkg_resources.
3. Special case the heck out of pip upgrading itself to ignore errors from
trying to replace the exe (as long as the exe is unchanged, based on a
size/checksum check)

This covers the replacing-the-exe issue and the entry point script problems
of vendoring setuptools.

I don't *like* this option, but at least it's not going to break big chunks
of our userbase...

There are some other options I'd still like to explore before settling on
something, for example making pip install from sdist *always* build a
temporary wheel and then always install from wheels - we can then
introspect the wheel before installing and catch this type of issue before
starting. That lets us easily avoid the "overwriting the exe" issue, as
well as letting us cleanly roll back failed installs.

One thing is clear - this is a longer term effort, not a quick fix...

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


More information about the Distutils-SIG mailing list