diff --git a/README.md b/README.md index 8cc915e..7575b7d 100644 --- a/README.md +++ b/README.md @@ -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: 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: diff --git a/setup.py b/setup.py index 51a9fd3..9041997 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,7 @@ #!/usr/bin/env python 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 setuptools_version = pkg_resources.get_distribution("setuptools").version @@ -23,10 +15,6 @@ import sys from buildutils import test_build, fetch_libcapnp, build_libcapnp, info from distutils.errors import CompileError 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__) @@ -85,15 +73,15 @@ if force_bundled_libcapnp: force_system_libcapnp = "--force-system-libcapnp" in sys.argv if 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 if force_cython: sys.argv.remove("--force-cython") 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): def build_extension(self, ext): @@ -127,6 +115,8 @@ class build_libcapnp_ext(build_ext_c): return build_ext_c.run(self) if use_cython: + from Cython.Build import cythonize + import Cython extensions = cythonize('capnp/lib/*.pyx') else: extensions = [Extension("capnp.lib.capnp", ["capnp/lib/capnp.cpp"],