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:

  1. Installed the standard Python 2.4 distribution from the MSI package.
  2. Installed the MingW compiler (into the standard location C:\MingW)
  3. Created C:\Documents and Settings\Philipp\pydistutils.cfg and put the following text in it:
    [build]
    compiler=mingw32

    This tells distutils to always use the MingW compiler whenever it has to compile something from C.

  4. Went to the Control Panel -> System -> Advanced tab and clicked on the Environment Variables button. There I appended the following text to the the Path environment variable, adding the Python interpreter as well as MingW’s programs to the search path:
    ;C:\Python24;C:\MingW\bin

    Then I added another environment variabled called HOME with the following value:

    C:\Documents and Settings\Philipp

    This points distutils at the pydistutils.cfg file that I created earlier (you can put the pydistutils.cfg file anywhere you want, you just need to make sure that the HOME environment
    variable points to the directory).

  5. 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.

3 Responses to “Cheap binary Windows eggs”

  1. philikon Says:

    Thanks, Hanno. This is a great tutorial (nice screenshots!). Since it actually covers a lot more, my how-to above is probably still useful for those who just want to create binary Windows eggs and don’t care about zc.buildout and other Zope- and Plone-related stuff.

  2. Lukasz Says:

    Thanks Philipp for this article. I’m a little sceptic about buildout but maybe I’ll try it now.

    There are no many Zope/Plone developers working on Windows. But it is nice that you also remember about that niche.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: