[Distutils] easy_install: Manifest.in "Permission denied" on windows

Phillip J. Eby pje at telecommunity.com
Tue Feb 21 23:46:59 CET 2006

At 12:50 PM 2/21/2006 -0800, Ville Vainio wrote:
>C:\Documents and Settings\v.V-V1OB9XEEN3RDB>easy_install ipython==dev
>Searching for ipython==dev
>Reading http://www.python.org/pypi/ipython/
>Reading http://ipython.scipy.org
>Reading http://ipython.scipy.org/dist
>Best match: ipython dev
>Downloading http://ipython.scipy.org/svn/ipython/ipython/trunk#egg=ipython-dev
>Doing subversion checkout from 
>k to i:\temp\easy_install-8fjbp2\trunk
>   File 
> "f:\python24\lib\site-packages\setuptools-0.6a10-py2.4.egg\setuptools\com
>mand\easy_install.py", line 1384, in auto_chmod
>     return func(arg)
>OSError: [Errno 13] Permission denied: 

Wow, this was tough to track down, but it's a bug in IPython's MANIFEST.in 
file.  It has a line that reads 'exclude doc/#*', but this isn't a validly 
formatted line.  The '#' has to be preceded with a '\', or it doesn't work.

That is, the line should read:

     exclude doc/\#*

and then it will work correctly on all platforms.  This will also eliminate 
the need for IPython's workaround in setup.py for "sdist not working on 
Windows".  The truth is that this line is broken on non-Windows platforms 
too, in that it doesn't do what the author thinks it does.  The old version 
of this line simply excludes doc/, the #* part is just ignored.  On 
Windows, this produces an error because convert_path() complains about the 
trailing /; on Posix platforms the string is simply left as-is by 
convert_path(), causing a silent failure.

Please report this issue to the IPython developers so they can fix their 
MANIFEST.in.  The problem has zero to do with setuptools, and it's not a 
Windows-specific problem, either.  It's just that the failure is silent on 
non-Windows platforms -- and again, it happens whether setuptools is 
involved or not.

As for why you never saw the actual error in the MANIFEST.in, the issue was 
that easy_install wraps the setup script in a try/finally that removes 
everything from the temporary directory, but the MANIFEST.in file is still 
open when that occurs.  And on Windows, it's not possible to delete an open 
file, so that error was then hiding the MANIFEST.in problem.  I'm changing 
setuptools now to work around this so that if an error occurs while reading 
MANIFEST.in, the file will be closed, allowing the temporary directory to 
be cleaned up.

One way that you can see the problem is to do this:

    easy_install -eb. ipython==dev

which creates an 'ipython' subdirectory.  If you then do:

    easy_install ipython

you'll see the ValueError from MANIFEST.in because it's not trying to 
delete the checkout.  Thus, the problem with the file being open doesn't 
occur, and you can see the ValueError being raised.

More information about the Distutils-SIG mailing list