[Distutils] easy_install: bugs with pathing and multi-version
Mars
mfogels at gmail.com
Fri Mar 24 15:23:53 CET 2006
> From: pje at telecommunity.com (Phillip J. Eby)
> Date: 3/17/2006 10:07 PM (Eastern Standard Time)
> To: mfogels at interactdirect.com (Maris Fogels)
> Cc: distutils-sig at python.org
> Subject: Re: easy_install: bugs with pathing and multi-version
>
> At 10:11 PM 3/16/2006 +0000, Maris Fogels wrote:
> >zipimport.ZipImportError: bad local file header in
> >/data/myproject/myproject-1.0-py2.3.egg
> >
> >If I re-run the 'easy_install -m .' command it works properly.
> >Everything in the installed .egg file appears to work correctly, so I
> >could not figure out why a ZipImportError was being raised by a
> >working .egg.
>
> Me either. The only time I've seen anything like that happen is with
> Python 2.3 on a 64-bit platform. If you can figure out how to reproduce
> it, please let me know.
>
Thankfully the problem is trivial for me to reproduce, and I was able
to run the script through pdb. I believe I have isolated the cause of
the problem, but I have not had the time to devise a solution.
The problem starts with a normal installation, in a clean directory,
using the command 'easy_install .'. There is a custom setup.cfg file
there that specifies the install-directory. During installation a
temporary egg file is created, along with the projectname.egg-info
directory. The temporary egg is copied into the installation
directory and renamed.
I noted that the newly created SOURCES.txt manifest on my system
does not contain an entry for itself. But the [incorrect] manifest file is
properly wrapped into the egg.
To uninstall, we run the command 'easy_install -m .'. This creates a
new egg file, along with a new manifest. This new manifest does
contain a reference to itself. This changes the egg file size and the
contained zip-file offsets. At this point we have two different egg files
and two different egg file definitions, with different zip-file offsets.
The new egg file definiton is used to open the egg in the install directory.
However, the egg that the install script finds there is a copy of the
orginal temporary egg file, and the old file offsets do not match the new
definition. Thus a ZipImportError is raised.
I was under the impression that a fix to the class
setuptools.command.egg_info.manifest_maker was in order, but the code
already ensures that the manifest contains the needed self-reference.
A run through the debugger should either verify this or pick up the
bug.
Maris
More information about the Distutils-SIG
mailing list