How to easy_install from source package with mingw32 on Windows?

Folks: Thank you for the various Python packaging tools! I just published a new version of a Free Software package: http://cheeseshop.python.org/pypi/zfec And I tested it with "easy_install zfec" on Windows XP, and I was disappointed to see this error message: """ error: Setup script exited with error: Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed. """ If I download the zfec source tarball and execute """ ./setup.py install """ Then I get the same error message, but if I execute """ ./setup.py build -c mingw32 install """ Then it successfully builds and installs. (This is on Python 2.4 -- I believe that in Python 2.5 that error message has been updated to mention that mingw is an option.) So my first question is: how can I configure the zfec source package so that someone who has mingw installed and who runs "easy_install zfec" successfully builds it? A deeper question is: wouldn't it be nice if "./setup.py install" automatically used the "build -c mingw32" feature when necessary? Would anyone be interested in extending distutils to do that? Regards, Zooko

zooko wrote:
A deeper question is: wouldn't it be nice if "./setup.py install" automatically used the "build -c mingw32" feature when necessary? Would anyone be interested in extending distutils to do that?
You can configure it to do so already. Making distutils automatically figure out that this is desired and safe is probably more magic than it's worth. http://docs.python.org/inst/config-syntax.html Use a section in your pydistutils.cfg file like this: [build_ext] compiler=mingw32 -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

(quoting out-of-order) On Sep 12, 2007, at 7:54 PM, Robert Kern wrote:
Use a section in your pydistutils.cfg file like this:
[build_ext] compiler=mingw32
Thank you very much!
You can configure it to do so already. Making distutils automatically figure out that this is desired and safe is probably more magic than it's worth.
So why isn't the Free Software compiler the default when no compiler is specified? It works fine. If I understand, there is currently no gratis Microsoft compiler available that can be used to produce Python modules. By the way, glancing at the python-dev archives, it appears that every time a new version of Python is ready to be released, people discover that Microsoft has stopped shipping the version of their compiler that was used for the previous version of Python, requiring everyone to agree about whether to upgrade to the newest Microsoft compiler, or to somehow acquire copies of the old, no-longer-shipped Microsoft compiler. Occasionally, in these long, flamey threads on python-dev, one of the participants eventually says "Oh! I've just learned that I can use the Free Software compiler to compile my Python modules, so I didn't need to spend all this time attempting to acquire an obsolete Microsoft compiler!". If distutils used the Free Software compiler without requiring special configuration, it would be that much easier for folks to compile Python modules. Regards, Zooko

zooko wrote:
(quoting out-of-order)
On Sep 12, 2007, at 7:54 PM, Robert Kern wrote:
Use a section in your pydistutils.cfg file like this:
[build_ext] compiler=mingw32
Thank you very much!
You can configure it to do so already. Making distutils automatically figure out that this is desired and safe is probably more magic than it's worth.
So why isn't the Free Software compiler the default when no compiler is specified? It works fine.
Not always. mingw32 is still based on msvcrt6. You can make it link against msvcr7 to match the runtime of Python, but many of the implementations of the standard C headers are still intended for msvcrt6. C++ extensions using std::iostreams are vulnerable to segfaults if you reconfigure mingw32's specs file to only use msvcr7. Other extensions that pass FILE* pointers between them and Python will segfault if you don't reconfigure mingw32. There is no configuration of mingw32 that works for all extensions. The default is the default because it's the only one that's known to be safe. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
participants (2)
-
Robert Kern
-
zooko