[Distutils] easy_install -U setuptools fails on Windows (workaround)

Phillip J. Eby pje at telecommunity.com
Thu Nov 17 19:21:10 CET 2005


At 03:19 PM 11/16/2005 -0500, Brad Clements wrote:
>On 16 Nov 2005 at 14:24, Phillip J. Eby wrote:
>
> > these issues.  You can update your setuptools with:
> >
> >      easy_install -U setuptools
> >
>
>Except on windows, the easy_install binary is in-use:

Argh.  Curse you Windows, and your non-Posix filesystem that won't allow 
replacing open files!  :(

Thanks for pointing this out; I'll have to tell people to use ez_setup.py 
on Windows for upgrades.

Alternately, I could try having easy_install detect that an .exe targeted 
for upgrade is in use, and if the .exe is the same as the one it would have 
installed, it can ignore it.  Hm.  On the other hand, it would then mean 
that it would sometimes work, and sometimes not.

The real trouble is that the launcher uses spawnv() to run Python, which 
means that the original easy_install.exe is technically still in use while 
Python runs.  I have to do that in order to avoid returning to the shell 
prompt before the Python script runs, which produces weird effects (to say 
the least).  For some reason, an execv() of Python on Windows seems to 
create an independent process instead of replacing the current 
process.  So, I only use execv() to run GUI (.pyw) scripts on Windows.

If somebody with more Windows-fu than me can suggest a way to do a more 
exec-like exec, that unloads the launcher.exe and runs Python without 
dropping back to a shell prompt *before* the Python script runs, I could 
make easy_install safely self-upgrading on Windows.



More information about the Distutils-SIG mailing list