Only 'cythonize' if Cython is installed.

This commit is contained in:
hofmockel 2015-08-16 12:17:47 +02:00
parent 61e8ae7668
commit 8481bc2481

View file

@ -1,11 +1,18 @@
from setuptools import setup
from setuptools import find_packages
from distutils.extension import Extension
from Cython.Build import cythonize
try:
from Cython.Build import cythonize
except ImportError:
def cythonize(extensions): return extensions
sources = ['rocksdb/_rocksdb.cpp']
else:
sources = ['rocksdb/_rocksdb.pyx']
mod1 = Extension(
'rocksdb._rocksdb',
['rocksdb/_rocksdb.pyx'],
sources,
extra_compile_args=[
'-std=c++11',
'-O3',
@ -32,10 +39,7 @@ setup(
author_email="Use the github issues",
url="https://github.com/stephan-hof/pyrocksdb",
license='BSD License',
install_requires=[
'setuptools',
'Cython>=0.20',
],
install_requires=['setuptools'],
package_dir={'rocksdb': 'rocksdb'},
packages=find_packages('.'),
ext_modules=cythonize([mod1]),