summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2006-04-07 19:04:09 (GMT)
committerThomas Heller <theller@ctypes.org>2006-04-07 19:04:09 (GMT)
commiteba43c157b1ed57bf95144f704d56c3296a6f637 (patch)
tree547cc3b905c96b9ee3649efa341e4412b7c1da3c
parent6e3a66de918cab1e14b5d689843e160eb6deabda (diff)
downloadcpython-eba43c157b1ed57bf95144f704d56c3296a6f637.zip
cpython-eba43c157b1ed57bf95144f704d56c3296a6f637.tar.gz
cpython-eba43c157b1ed57bf95144f704d56c3296a6f637.tar.bz2
Configure Modules/_ctypes/libffi just before building the _ctypes extension.
This avoids configuring it when it is not build by setup.py.
-rw-r--r--setup.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index fb33bba..5a19383 100644
--- a/setup.py
+++ b/setup.py
@@ -180,6 +180,9 @@ class PyBuildExt(build_ext):
def build_extension(self, ext):
+ if ext.name == '_ctypes':
+ self.configure_ctypes(ext)
+
try:
build_ext.build_extension(self, ext)
except (CCompilerError, DistutilsError), why:
@@ -1264,7 +1267,7 @@ class PyBuildExt(build_ext):
# *** Uncomment these for TOGL extension only:
# -lGL -lGLU -lXext -lXmu \
- def detect_ctypes(self):
+ def configure_ctypes(self, ext):
(srcdir,) = sysconfig.get_config_vars('srcdir')
ffi_builddir = os.path.join(self.build_temp, 'libffi')
ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
@@ -1296,12 +1299,20 @@ class PyBuildExt(build_ext):
include_dirs = [os.path.join(ffi_builddir, 'include'),
ffi_builddir, ffi_srcdir]
extra_compile_args = fficonfig['ffi_cflags'].split()
+
+ ext.sources.extend(fficonfig['ffi_sources'])
+ ext.include_dirs.extend(include_dirs)
+ ext.extra_compile_args.extend(extra_compile_args)
+
+ def detect_ctypes(self):
+ include_dirs = []
+ extra_compile_args = []
sources = ['_ctypes/_ctypes.c',
'_ctypes/callbacks.c',
'_ctypes/callproc.c',
'_ctypes/stgdict.c',
'_ctypes/cfield.c',
- '_ctypes/malloc_closure.c'] + fficonfig['ffi_sources']
+ '_ctypes/malloc_closure.c']
depends = ['_ctypes/ctypes.h']
if sys.platform == 'darwin':