Author: Kaito Udagawa <[email protected]>
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
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to