[Distutils] distutil or setup problem?
Berthold Höllmann
hoel@germanlloyd.org
Thu Nov 30 03:24:01 2000
hoel@germanlloyd.org (Berthold Höllmann) writes:
> "Thomas Heller" <thomas.heller@ion-tof.com> writes:
>
> > As you can see from the comments, 'python15.lib' SHOULD be included by =
some
> > pragma inside 'config.h', which is #included be 'Python.h'.
> > May be there is something wrong with the include files?
> > Or has this something to do with the fact (IIRC from your first posting=
),
> > that your source code does not reside in some subdirectories?
>
> Thomas,
>
> Thanks for your help. It led me to the right direction. I was using
> another library that which had anther config.h in it's include
> directories, which prevented the python config.h to be used
> correctly. After some fiddeling with include pathes, I now can
> successfully compile my module.
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.