[pypy-commit] cffi build-with-xcode-only: Able to build on macOS only with Xcode but without CLT
umireon
pypy.commits at gmail.com
Sun Nov 27 03:38:28 EST 2016
Author: Kaito Udagawa <umireon at gmail.com>
Branch: build-with-xcode-only
Changeset: r2820:75a9bf95e46d
Date: 2016-11-26 00:35 +0900
http://bitbucket.org/cffi/cffi/changeset/75a9bf95e46d/
Log: Able to build on macOS only with Xcode but without CLT
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.
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -122,6 +122,20 @@
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
More information about the pypy-commit
mailing list