summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorKaito Udagawa <umireon@gmail.com>2016-11-26 00:35:41 +0900
committerKaito Udagawa <umireon@gmail.com>2016-11-26 00:35:41 +0900
commit85c7260adc0d84b127914b5c3f61589c24890778 (patch)
tree04a61d98f348e7ebd15c3ff2adcbafa87672a9d8 /setup.py
parent5a6c5811503c6898d809aedc8d7736aa579da0ea (diff)
downloadcffi-85c7260adc0d84b127914b5c3f61589c24890778.tar.gz
Able to build on macOS only with Xcode but without CLTbuild-with-xcode-only
In macOS, two different build environment exists: Xcode.app and Xcode Command Line Tools (aka CLT) By this change setuptools considers the header under Xcode.app, and cffi can build every environment where cc exists.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 97cc8ad..5d44986 100644
--- a/setup.py
+++ b/setup.py
@@ -122,6 +122,20 @@ else:
if 'freebsd' in sys.platform:
include_dirs.append('/usr/local/include')
+if 'darwin' in sys.platform:
+ try:
+ p = subprocess.Popen(['xcrun', '--show-sdk-path'],
+ stdout=subprocess.PIPE)
+ except OSError as e:
+ if e.errno not in [errno.ENOENT, errno.EACCES]:
+ raise
+ else:
+ t = p.stdout.read().decode().strip()
+ p.stdout.close()
+ if p.wait() == 0:
+ include_dirs.append(t + '/usr/include/ffi')
+
+
if __name__ == '__main__':
from setuptools import setup, Distribution, Extension