Author: Armin Rigo <[email protected]>
Branch: cffi-1.0
Changeset: r2031:61fa24c052cb
Date: 2015-05-17 13:16 +0200
http://bitbucket.org/cffi/cffi/changeset/61fa24c052cb/
Log: Naive. This has more chances to work...
diff --git a/doc/source/cdef.rst b/doc/source/cdef.rst
--- a/doc/source/cdef.rst
+++ b/doc/source/cdef.rst
@@ -699,17 +699,17 @@
(FWIW, this latest trick can be used more generally to allow the
import to "work" even if the ``_foo`` module was not generated yet.)
-Then you would say, in the Setuptools ``setup.py`` script::
+Writing a ``setup.py`` script that works both with CFFI 0.9 and 1.0
+is harder. The best I can think about is to say::
- setup(
- ...,
- setup_requires=["cffi"], # any version
- cffi_modules=["package/foo_build.py:ffi"],
- install_requires=["cffi"], # any version
- )
+ if '_cffi_backend' in sys.builtin_module_names:
+ import _cffi_backend
+ old_cffi = _cffi_backend.__version__.startswith('0.')
+ else:
+ old_cffi = False # assume at least 1.0.0 will be installed
-i.e. still giving ``cffi_modules``---it produces a warning if the CFFI
-version installed is pre-1.0, but still works.
+and then use the ``old_cffi`` variable to give different arguments
+to ``setup()`` as needed.
.. __: out-of-line-api_
.. __: distutils-setuptools_
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit