[Distutils] easy_install - some thoughts

Phillip J. Eby pje at telecommunity.com
Wed Jul 13 00:40:29 CEST 2005

At 10:11 PM 7/12/2005 +0100, Paul Moore wrote:
>On 7/12/05, Kevin Dangoor <dangoor at gmail.com> wrote:
> > On 7/12/05, Paul Moore <p.f.moore at gmail.com> wrote:
> > > By the way, I don't know if the sqlite web page has changed, but your
> > > standard example of sqlite doesn't work for me:
> >
> > It may be pysqlite.
>It's not, it's Python 2.4 :-(

Aha.  :)

>It looks like setuptools.command.easy_install is doing some ugly hacks
>to read data out of the raw bdist_wininst file, in

Well, no uglier than the hacks that put them in there.  :)

>extract_wininst_cfg, and the file format has changed in Python 2.4.
>For 2.4, it looks like the "tag" has just changed from 0x1234567A to
>0x1234567B... So just checking both values should work. I've attached
>a patch.

That's not the end of the difference, I'm afraid.  See below.

>Still doesn't work, as I get an error about the (not-)zip-safe file:
> >python -m easy_install -xd eggs Python\ctypes-0.9.6.win32-py2.4.exe
>Processing ctypes-0.9.6.win32-py2.4.exe
>ctypes.__init__: module references __file__
>ctypes.com.register: module references __file__
>EGG-INFO\not-zip-safe: No such file or directory
>It looks like the issue is in bdist_egg.py, write_safety_flag, where
>an ensure_directory() call is needed. There's a patch for this below,
>as well.

Actually, the problem is that install_exe() isn't creating the EGG-INFO 
directory in the first place, but your fix is okay as a workaround.  (The 
difference is that if converting from exe->egg ever needs any other 
metadata files, the problem could recur; but by creating EGG-INFO up front 
in install_exe(), creating other metadata files should be fine.)

>But even then, things are going odd, as if I try to build an egg for
>ctypes (which isn't zip-safe) all of the files and subdirectories in
>the egg directory are missing the first two characters... Hmm, it
>happens with zip-safe eggs, as well, so I don't know - maybe it's
>related to the bdist_wininst unpacking code. Sorry, I can't debug this
>any further.

And I can't reproduce it.  However, I have noticed that the format change 
for Python 2.4 includes a change to what data is in the 'cfgdata' string, 
and so I changed this line:


to read:


In order to ignore anything after the first NUL character in the 
cfgdata.  I don't know if that was causing your two-character problem or 
not, as I can't reproduce it with Python 2.4 and the ctypes .exe for Python 

>BTW, it would be useful to have some type of debug flag which left the
>temporary directory around for debugging...

See the --build-dir/-b option, which is what I used to do my own 
investigation of the above.  The time machine strikes again!  :)

Unfortunately, the time machine won't let me fix bugs because it would 
create an infinite time loop; if I only know about the bug because you 
report it, then going back to fix the bug would mean you wouldn't report 
it, and so on.  After the first thousand levels of recursion, the time 
machine throws a RuntimeError("Paradox stablization loop limit exceeded") 
and kicks me back to the present.  :)

More information about the Distutils-SIG mailing list