Cheap binary Windows eggs
August 7, 2008
(This is a post from my old blog which seems to be going offline once in a while, maybe even permanently at some point. This article is still very useful so I’ve reposted it here for other people’s and my reference.)
Thanks to Hanno Schlichting’s howto, I’ve figured out how to create Windows eggs of those packages that have C extensions. This approach doesn’t need Microsoft Visual Studio, nor does it require you to wade
through a bunch of free Microsoft downloads that don’t really work in the end anyway.
Here’s what I did:
- Installed the standard Python 2.4 distribution from the MSI package.
- Installed the MingW compiler (into the standard location
Settings\Philipp\pydistutils.cfgand put the following text in it:
This tells distutils to always use the MingW compiler whenever it has to compile something from C.
- Went to the Control Panel -> System -> Advanced tab and clicked on the Environment Variables button. There I appended the following text to the the
Pathenvironment variable, adding the Python interpreter as well as MingW’s programs to the search path:
Then I added another environment variabled called
HOMEwith the following value:
C:\Documents and Settings\Philipp
This points distutils at the
pydistutils.cfgfile that I created earlier (you can put the
pydistutils.cfgfile anywhere you want, you just need to make sure that the
variable points to the directory).
- With that in place, I am able to take any tarball (e.g.
zope.interface-3.4.0.tgz), unzip it and create a Windows egg from it like so:
python setup.py bdist_egg
What’s more, with a setup like this, it is easily possible to install Zope 3 completely from eggs (e.g. using zc.buildout) even if there are no pre-built Windows eggs on the Cheeseshop. More specifically, with this setup, zopeproject (which is really just a convenience tool over zc.buildout) works like a charm on Windows now.