[pypy-svn] r79821 - pypy/branch/cpyext-darwin/lib-python/modified-2.5.2/distutils

danchr at codespeak.net danchr at codespeak.net
Sat Dec 4 20:51:01 CET 2010


Author: danchr
Date: Sat Dec  4 20:50:59 2010
New Revision: 79821

Modified:
   pypy/branch/cpyext-darwin/lib-python/modified-2.5.2/distutils/unixccompiler.py
Log:
distutils: Add hack to allow building C extensions on Mac OS X.

Modified: pypy/branch/cpyext-darwin/lib-python/modified-2.5.2/distutils/unixccompiler.py
==============================================================================
--- pypy/branch/cpyext-darwin/lib-python/modified-2.5.2/distutils/unixccompiler.py	(original)
+++ pypy/branch/cpyext-darwin/lib-python/modified-2.5.2/distutils/unixccompiler.py	Sat Dec  4 20:50:59 2010
@@ -121,7 +121,22 @@
                   }
 
     if sys.platform[:6] == "darwin":
+        import platform
+        if platform.machine() == 'i386':
+            if platform.architecture()[0] == '32bit':
+                arch = 'i386'
+            else:
+                arch = 'x86_64'
+        else:
+            # just a guess
+            arch = platform.machine()
         executables['ranlib'] = ["ranlib"]
+        executables['linker_so'] += ['-undefined', 'dynamic_lookup']
+
+        for k, v in executables.iteritems():
+            if v and v[0] == 'cc':
+                v += ['-arch', arch]
+
 
     # Needed for the filename generation methods provided by the base
     # class, CCompiler.  NB. whoever instantiates/uses a particular



More information about the Pypy-commit mailing list