summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-01 12:53:46 (GMT)
committerGitHub <noreply@github.com>2019-03-01 12:53:46 (GMT)
commit96d81583be98cec9728636186ea32b662cb091d5 (patch)
tree4b8ffac5a91b29547833df6a617940c980c783df
parent62be763348d16ba90f96667aa0240503261393f0 (diff)
downloadcpython-96d81583be98cec9728636186ea32b662cb091d5.zip
cpython-96d81583be98cec9728636186ea32b662cb091d5.tar.gz
cpython-96d81583be98cec9728636186ea32b662cb091d5.tar.bz2
bpo-36146: Fix inc_dirs in setup.py on macOS (GH-12098)
Fix setup.py on macOS: only add /usr/include/ffi to include directories of _ctypes, not for all extensions.
-rw-r--r--Misc/NEWS.d/next/Build/2019-02-28-18-09-01.bpo-36146.IwPJVT.rst2
-rw-r--r--setup.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Build/2019-02-28-18-09-01.bpo-36146.IwPJVT.rst b/Misc/NEWS.d/next/Build/2019-02-28-18-09-01.bpo-36146.IwPJVT.rst
new file mode 100644
index 0000000..93c1e1a
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2019-02-28-18-09-01.bpo-36146.IwPJVT.rst
@@ -0,0 +1,2 @@
+Fix setup.py on macOS: only add ``/usr/include/ffi`` to include
+directories of _ctypes, not for all extensions.
diff --git a/setup.py b/setup.py
index 2fef0ad..56a1df3 100644
--- a/setup.py
+++ b/setup.py
@@ -2003,16 +2003,17 @@ class PyBuildExt(build_ext):
libraries=['m'])
self.extensions.extend([ext, ext_test])
+ ffi_inc_dirs = inc_dirs.copy()
if MACOS:
if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
return
# OS X 10.5 comes with libffi.dylib; the include files are
# in /usr/include/ffi
- inc_dirs.append('/usr/include/ffi')
+ ffi_inc_dirs.append('/usr/include/ffi')
ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
if not ffi_inc or ffi_inc[0] == '':
- ffi_inc = find_file('ffi.h', [], inc_dirs)
+ ffi_inc = find_file('ffi.h', [], ffi_inc_dirs)
if ffi_inc is not None:
ffi_h = ffi_inc[0] + '/ffi.h'
if not os.path.exists(ffi_h):