Commits

Armin Rigo  committed 3c10fb4

Copy-pasted :-(

  • Participants
  • Parent commits 7ecde53

Comments (0)

Files changed (1)

 from setuptools import setup, Feature, Extension
 
 
-from setup_base import sources, libraries, include_dirs
+sources = ['c/_ffi_backend.c']
+libraries = ['ffi']
+include_dirs = []
+
+
+if sys.platform == 'win32':
+    COMPILE_LIBFFI = 'c/libffi_msvc'    # from the CPython distribution
+else:
+    COMPILE_LIBFFI = None
+
+if COMPILE_LIBFFI:
+    assert os.path.isdir(COMPILE_LIBFFI), (
+        "On Windows, you need to copy the directory "
+        "Modules\\_ctypes\\libffi_msvc from the CPython sources (2.6 or 2.7) "
+        "into the top-level directory.")
+    include_dirs.append(COMPILE_LIBFFI)
+    libraries.remove('ffi')
+    sources.extend(os.path.join(COMPILE_LIBFFI, filename)
+                   for filename in os.listdir(COMPILE_LIBFFI)
+                   if filename.lower().endswith('.c'))