Commits

Maciej Fijalkowski  committed e090689 Merge

merge

  • Participants
  • Parent commits e42d3fd, 32527f1

Comments (0)

Files changed (2)

 import sys, os
-from setuptools import setup, Feature, Extension
 
 
 sources = ['c/_ffi_backend.c']
                    if filename.lower().endswith('.c'))
 
 
-
-setup(
+if __name__ == '__main__':
+  from setuptools import setup, Feature, Extension
+  setup(
     name='cffi',
     description='Foreign Function Interface for Python calling C code.',
     get_version_from_scm=True,
     install_requires=[
         'pycparser',
     ]
-)
+  )

File setup_base.py

 import sys, os
 
 
-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'))
+from setup import include_dirs, sources, libraries
 
 
 if __name__ == '__main__':