[Distutils] MSVC CRT woes

Thomas Heller theller at python.net
Thu Feb 5 16:18:26 EST 2004

"Mark Hammond" <mhammond at skippinet.com.au> writes:

> 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?

Since wininst.exe dynamically loads the Python dll (even different
versions), it is already fairly limited in the Python api it can use.
Avoiding the call to PyRun_SimpleFile is still an option.

Isn't it fun to break the rules ;-) ?


More information about the Distutils-SIG mailing list