[Distutils] Replacing pip.exe with a Python script

Donald Stufft donald at stufft.io
Mon Jul 15 19:26:00 CEST 2013

On Jul 15, 2013, at 9:39 AM, Paul Moore <p.f.moore at gmail.com> wrote:

> I'm looking at the possibility of replacing the current setuptools entry point based pip executables with Python scripts. The biggest problem is that a script "pip.py" shadows the pip package, making "import pip" fail.
> I can get round this by deleting sys.path[0] (the location of the currently running script) but how robust is that? Are there any corner cases where it would break? Or alternatively, is there a better way to do this rather than messing directly with sys.path? I suspect this is a fairly common question, but my Google-fu is failing me :-(
> Sorry, I know this is a basic Python coding question - in my defence, it's for something related to the current pip discussions :-)
> Paul
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig

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.

Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130715/317bdb44/attachment.pgp>

More information about the Distutils-SIG mailing list