diff options
author | Kaito Udagawa <umireon@gmail.com> | 2016-11-26 00:35:41 +0900 |
---|---|---|
committer | Kaito Udagawa <umireon@gmail.com> | 2016-11-26 00:35:41 +0900 |
commit | 85c7260adc0d84b127914b5c3f61589c24890778 (patch) | |
tree | 04a61d98f348e7ebd15c3ff2adcbafa87672a9d8 /setup.py | |
parent | 5a6c5811503c6898d809aedc8d7736aa579da0ea (diff) | |
download | cffi-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.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 |