[Distutils] MSVC CRT woes

Mark Hammond mhammond at skippinet.com.au
Wed Feb 4 19:15:14 EST 2004


One of our politicians famously uttered "life wasn't meant to be easy" - how
right he was :)

Let's assume I am trying to use distutils from Python 2.4 to package an
installation for both Python 2.3 and Python 2.4 (or vice-versa - trying to
use 2.3 distutils to package them both).  As mentioned her previously, I
want to do this so I can use the features in later versions of distutils
(such as the post-install-script) to package extensions for earlier versions
of Python.

The installation script uses PyRun_SimpleFile.  This takes a FILE *.  The
problem is that Python 2.3 and Python 2.4 use different runtime libraries.
One of them is guaranteed to crash.  This violates the Python rule that
Python and its extensions must use the same CRTL.

I see 2 choices:
* Avoid PyRun_SimpleFile, by reading the file ourself, and using
PyRun_SimpleString.  This should work, but is fragile, as we are still
breaking that rule.
* Provide 2 different wininst.exe stubs, one for MSVC6 and one for MSVC7.
distutils hardcodes the knowledge of what one to use for what version.
However, the problem is that this will mean people building distutils to
ship will always need *both* VC6 and VC7 - VC6 just for that stub, and VC7
to build everything else.

The first option is less work, and should work today, but is still naughty.
Any thoughts?

Mark.




More information about the Distutils-SIG mailing list