Re: [Distutils] distutil or setup problem?

hoel@germanlloyd.org (Berthold Höllmann) writes:
Ahh, I'm wrong. Distutils 1.0.1 do not work with Python 1.5.2 on Win32 because the 1.5.2 config.h for Win does *not* contain the neccesarry #pragma definitions for the library inclusion (at least in my copy). So I guess get_libraries in distutils/command/build_ext.py should be changed to something like def get_libraries (self, ext): """Return the list of libraries to link against when building a shared extension. On most platforms, this is just 'ext.libraries'; on Windows, we add the Python library (eg. python20.dll). """ # The python library is always needed on Windows. For MSVC, this # is redundant, since the library is mentioned in a pragma in # config.h that MSVC groks. The other Windows compilers all seem # to need it mentioned explicitly, though, so that's what we do. # Append '_d' to the python import library on debug builds. from distutils.msvccompiler import MSVCCompiler if sys.platform == "win32" and \ (not isinstance(self.compiler, MSVCCompiler) or sys.version[:5] == 1.5.2): template = "python%d%d" if self.debug: template = template + '_d' pythonlib = (template % (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib] else: return ext.libraries to make building extension modules work with 1.5.2. Greetings Berthold -- email: hoel@GermanLloyd.org ) tel. : +49 (40) 3 61 49 - 73 74 ( C[_] These opinions might be mine, but never those of my employer.

hoel@germanlloyd.org (Berthold Höllmann) writes:
This is from 1.5.2 config.h: #ifdef MS_WIN32 #ifndef USE_DL_EXPORT /* So nobody needs to specify the .lib in their Makefile any more */ #ifdef _DEBUG #pragma comment(lib,"python15_d.lib") #else #pragma comment(lib,"python15.lib") #endif #endif /* USE_DL_EXPORT */ So, it *should* work... And it *does* work, just checked it out.
It has been debated on distutils-sig in the past whether build_ext should special-case MSVCCompiler or not. Maybe we should remove this special case completely. Anyway, I would be interrested why it does not work for you. Thomas

hoel@germanlloyd.org (Berthold Höllmann) writes:
This is from 1.5.2 config.h: #ifdef MS_WIN32 #ifndef USE_DL_EXPORT /* So nobody needs to specify the .lib in their Makefile any more */ #ifdef _DEBUG #pragma comment(lib,"python15_d.lib") #else #pragma comment(lib,"python15.lib") #endif #endif /* USE_DL_EXPORT */ So, it *should* work... And it *does* work, just checked it out.
It has been debated on distutils-sig in the past whether build_ext should special-case MSVCCompiler or not. Maybe we should remove this special case completely. Anyway, I would be interrested why it does not work for you. Thomas
participants (2)
-
Berthold Höllmann
-
Thomas Heller