Default to not using cython
This commit is contained in:
@@ -29,7 +29,7 @@ Install with `pip install pycapnp`. You can set the CC environment variable to c
|
|||||||
Or you can clone the repo like so:
|
Or you can clone the repo like so:
|
||||||
|
|
||||||
git clone https://github.com/jparyani/pycapnp.git
|
git clone https://github.com/jparyani/pycapnp.git
|
||||||
pip install ./pycapnp
|
pip install --install-option '--force-cython' ./pycapnp
|
||||||
|
|
||||||
Note: for OSX, if using clang from Xcode 5, you will need to set `CFLAGS` like so:
|
Note: for OSX, if using clang from Xcode 5, you will need to set `CFLAGS` like so:
|
||||||
|
|
||||||
|
|||||||
22
setup.py
22
setup.py
@@ -1,14 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
use_cython = True
|
|
||||||
try:
|
|
||||||
from Cython.Build import cythonize
|
|
||||||
import Cython
|
|
||||||
except ImportError:
|
|
||||||
use_cython = False
|
|
||||||
|
|
||||||
if use_cython and Cython.__version__ < '0.19.1':
|
|
||||||
use_cython = False
|
use_cython = False
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
@@ -23,10 +15,6 @@ import sys
|
|||||||
from buildutils import test_build, fetch_libcapnp, build_libcapnp, info
|
from buildutils import test_build, fetch_libcapnp, build_libcapnp, info
|
||||||
from distutils.errors import CompileError
|
from distutils.errors import CompileError
|
||||||
from distutils.extension import Extension
|
from distutils.extension import Extension
|
||||||
if use_cython:
|
|
||||||
from Cython.Distutils import build_ext as build_ext_c
|
|
||||||
else:
|
|
||||||
from distutils.command.build_ext import build_ext as build_ext_c
|
|
||||||
|
|
||||||
_this_dir = os.path.dirname(__file__)
|
_this_dir = os.path.dirname(__file__)
|
||||||
|
|
||||||
@@ -85,15 +73,15 @@ if force_bundled_libcapnp:
|
|||||||
force_system_libcapnp = "--force-system-libcapnp" in sys.argv
|
force_system_libcapnp = "--force-system-libcapnp" in sys.argv
|
||||||
if force_system_libcapnp:
|
if force_system_libcapnp:
|
||||||
sys.argv.remove("--force-system-libcapnp")
|
sys.argv.remove("--force-system-libcapnp")
|
||||||
disable_cython = "--disable-cython" in sys.argv
|
|
||||||
if disable_cython:
|
|
||||||
sys.argv.remove("--disable-cython")
|
|
||||||
use_cython = False
|
|
||||||
force_cython = "--force-cython" in sys.argv
|
force_cython = "--force-cython" in sys.argv
|
||||||
if force_cython:
|
if force_cython:
|
||||||
sys.argv.remove("--force-cython")
|
sys.argv.remove("--force-cython")
|
||||||
use_cython = True
|
use_cython = True
|
||||||
|
|
||||||
|
if use_cython:
|
||||||
|
from Cython.Distutils import build_ext as build_ext_c
|
||||||
|
else:
|
||||||
|
from distutils.command.build_ext import build_ext as build_ext_c
|
||||||
|
|
||||||
class build_libcapnp_ext(build_ext_c):
|
class build_libcapnp_ext(build_ext_c):
|
||||||
def build_extension(self, ext):
|
def build_extension(self, ext):
|
||||||
@@ -127,6 +115,8 @@ class build_libcapnp_ext(build_ext_c):
|
|||||||
return build_ext_c.run(self)
|
return build_ext_c.run(self)
|
||||||
|
|
||||||
if use_cython:
|
if use_cython:
|
||||||
|
from Cython.Build import cythonize
|
||||||
|
import Cython
|
||||||
extensions = cythonize('capnp/lib/*.pyx')
|
extensions = cythonize('capnp/lib/*.pyx')
|
||||||
else:
|
else:
|
||||||
extensions = [Extension("capnp.lib.capnp", ["capnp/lib/capnp.cpp"],
|
extensions = [Extension("capnp.lib.capnp", ["capnp/lib/capnp.cpp"],
|
||||||
|
|||||||
Reference in New Issue
Block a user