[pypy-commit] cffi default: Move things around to avoid duplication of code. I hope "if
arigo
noreply at buildbot.pypy.org
Mon Jun 18 14:04:46 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r454:32527f1250e1
Date: 2012-06-18 14:04 +0200
http://bitbucket.org/cffi/cffi/changeset/32527f1250e1/
Log: Move things around to avoid duplication of code. I hope "if
__name__=='__main__'" works in setup.py.
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,4 @@
import sys, os
-from setuptools import setup, Feature, Extension
sources = ['c/_ffi_backend.c']
@@ -24,8 +23,9 @@
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,
@@ -53,4 +53,4 @@
install_requires=[
'pycparser',
]
-)
+ )
diff --git a/setup_base.py b/setup_base.py
--- a/setup_base.py
+++ b/setup_base.py
@@ -1,26 +1,7 @@
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__':
More information about the pypy-commit
mailing list