easy_install doesn't recognize valid distutils Windows installers

On Windows "easy_install trac" fails with the error: "trac-0.10b1.win32.exe is not a valid distutils Windows .exe" http://trac.edgewall.org/ticket/3750 The problem is with easy_install locating the config information embedded in the file. The following patch works with the Trac installer, but I don't know if it will break support for other installers: Index: setuptools/command/easy_install.py =================================================================== --- setuptools/command/easy_install.py (revision 51920) +++ setuptools/command/easy_install.py (working copy) @@ -1249,7 +1249,7 @@ if tag not in (0x1234567A, 0x1234567B): return None # not a valid tag - f.seek(prepended-(12+cfglen+bmlen)) + f.seek(prepended-(12+cfglen)) cfg = ConfigParser.RawConfigParser({'version':'','target_version':''}) try: cfg.readfp(StringIO.StringIO(f.read(cfglen).split(chr(0),1)[0])) -- Matt Good <matt@matt-good.net>

At 02:59 PM 9/19/2006 -0400, Matt Good wrote:
On Windows "easy_install trac" fails with the error: "trac-0.10b1.win32.exe is not a valid distutils Windows .exe"
http://trac.edgewall.org/ticket/3750
The problem is with easy_install locating the config information embedded in the file. The following patch works with the Trac installer, but I don't know if it will break support for other installers:
What version of Python was the .exe built with?

At 02:59 PM 9/19/2006 -0400, Matt Good wrote:
On Windows "easy_install trac" fails with the error: "trac-0.10b1.win32.exe is not a valid distutils Windows .exe"
http://trac.edgewall.org/ticket/3750
The problem is with easy_install locating the config information embedded in the file. The following patch works with the Trac installer, but I don't know if it will break support for other installers:
Index: setuptools/command/easy_install.py =================================================================== --- setuptools/command/easy_install.py (revision 51920) +++ setuptools/command/easy_install.py (working copy) @@ -1249,7 +1249,7 @@ if tag not in (0x1234567A, 0x1234567B): return None # not a valid tag
- f.seek(prepended-(12+cfglen+bmlen)) + f.seek(prepended-(12+cfglen))
I can't see how bdist_wininst for Python 2.3 or better can generate a file that's missing the 'bmlen' value or has garbage in it. bmlen corresponds to the 'bitmaplen' value generated by the bdist_wininst command, and it should be a zero if there was no custom bitmap added. In other words, the .exe you're having problems with doesn't seem like it could've been produced by an unmodified distutils bdist_wininst command, as I've checked the SVN logs for that module and it's been 5 years since bdist_wininst had the 'bitmaplen' value added.

On Wed, 2006-09-20 at 20:00 -0400, Phillip J. Eby wrote:
At 02:59 PM 9/19/2006 -0400, Matt Good wrote:
On Windows "easy_install trac" fails with the error: "trac-0.10b1.win32.exe is not a valid distutils Windows .exe"
http://trac.edgewall.org/ticket/3750
The problem is with easy_install locating the config information embedded in the file. The following patch works with the Trac installer, but I don't know if it will break support for other installers:
Index: setuptools/command/easy_install.py =================================================================== --- setuptools/command/easy_install.py (revision 51920) +++ setuptools/command/easy_install.py (working copy) @@ -1249,7 +1249,7 @@ if tag not in (0x1234567A, 0x1234567B): return None # not a valid tag
- f.seek(prepended-(12+cfglen+bmlen)) + f.seek(prepended-(12+cfglen))
I can't see how bdist_wininst for Python 2.3 or better can generate a file that's missing the 'bmlen' value or has garbage in it. bmlen corresponds to the 'bitmaplen' value generated by the bdist_wininst command, and it should be a zero if there was no custom bitmap added.
In other words, the .exe you're having problems with doesn't seem like it could've been produced by an unmodified distutils bdist_wininst command, as I've checked the SVN logs for that module and it's been 5 years since bdist_wininst had the 'bitmaplen' value added.
Well, that would make sense since the bdist_wininst command writes the bitmap *before* the config, not after as easy_install assumes. So, easy_install is seeking to the beginning of the bitmap as shown by the data here:
f.seek(prepended-(12+cfglen+bmlen)) f.read(5) 'BM.\x9c\x00'
So, seeking to the beginning of the config should omit the bmlen:
f.seek(prepended-(12+cfglen)) f.read(10) '[metadata]'
This is true at least back to Python 2.2: if bitmap: file.write(bitmapdata) file.write(cfgdata) The Trac installer I was testing on is available here: http://trac.edgewall.org/wiki/TracDownload -- Matt Good <matt@matt-good.net>

At 08:25 PM 9/20/2006 -0400, Matt Good wrote:
On Wed, 2006-09-20 at 20:00 -0400, Phillip J. Eby wrote:
In other words, the .exe you're having problems with doesn't seem like it could've been produced by an unmodified distutils bdist_wininst command, as I've checked the SVN logs for that module and it's been 5 years since bdist_wininst had the 'bitmaplen' value added.
Well, that would make sense since the bdist_wininst command writes the bitmap *before* the config, not after as easy_install assumes. So, easy_install is seeking to the beginning of the bitmap as shown by the data here:
f.seek(prepended-(12+cfglen+bmlen)) f.read(5) 'BM.\x9c\x00'
D'oh! I guess we're looking at having to release an *0.6c4* now. [sigh] Oh well, there was still the SF downloads issue to fix anyway. :(
participants (2)
-
Matt Good
-
Phillip J. Eby