[pypy-commit] cffi default: On PyPy, cffi is preinstalled and it is not possible, at least for now,

arigo noreply at buildbot.pypy.org
Fri May 22 10:43:24 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2085:447eca783ce6
Date: 2015-05-22 10:43 +0200
http://bitbucket.org/cffi/cffi/changeset/447eca783ce6/

Log:	On PyPy, cffi is preinstalled and it is not possible, at least for
	now, to install a different version. We work around it by making
	the setup() arguments mostly empty in this case.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -124,18 +124,11 @@
             # specific.  (thanks dstufft!)
             return True
 
-    ext_modules = []
-    if '__pypy__' not in sys.builtin_module_names:
-        ext_modules.append(Extension(
-            name='_cffi_backend',
-            include_dirs=include_dirs,
-            sources=sources,
-            libraries=libraries,
-            define_macros=define_macros,
-            library_dirs=library_dirs,
-            extra_compile_args=extra_compile_args,
-            extra_link_args=extra_link_args,
-        ))
+    # On PyPy, cffi is preinstalled and it is not possible, at least for now,
+    # to install a different version.  We work around it by making the setup()
+    # arguments mostly empty in this case.
+    cpython = ('_cffi_backend' not in sys.builtin_module_names)
+
     setup(
         name='cffi',
         description='Foreign Function Interface for Python calling C code.',
@@ -152,8 +145,9 @@
 `Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
 """,
         version='1.0.2',
-        packages=['cffi'],
-        package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h']},
+        packages=['cffi'] if cpython else [],
+        package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h']}
+                     if cpython else {},
         zip_safe=False,
 
         url='http://cffi.readthedocs.org',
@@ -163,17 +157,26 @@
         license='MIT',
 
         distclass=CFFIDistribution,
-        ext_modules=ext_modules,
+        ext_modules=[Extension(
+            name='_cffi_backend',
+            include_dirs=include_dirs,
+            sources=sources,
+            libraries=libraries,
+            define_macros=define_macros,
+            library_dirs=library_dirs,
+            extra_compile_args=extra_compile_args,
+            extra_link_args=extra_link_args,
+        )] if cpython else [],
 
         install_requires=[
             'pycparser',
-        ],
+        ] if cpython else [],
 
         entry_points = {
             "distutils.setup_keywords": [
                 "cffi_modules = cffi.setuptools_ext:cffi_modules",
             ],
-        },
+        } if cpython else {},
 
         classifiers=[
             'Programming Language :: Python',


More information about the pypy-commit mailing list