Only 'cythonize' if Cython is installed.
This commit is contained in:
parent
61e8ae7668
commit
8481bc2481
1 changed files with 10 additions and 6 deletions
16
setup.py
16
setup.py
|
@ -1,11 +1,18 @@
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from setuptools import find_packages
|
from setuptools import find_packages
|
||||||
from distutils.extension import Extension
|
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(
|
mod1 = Extension(
|
||||||
'rocksdb._rocksdb',
|
'rocksdb._rocksdb',
|
||||||
['rocksdb/_rocksdb.pyx'],
|
sources,
|
||||||
extra_compile_args=[
|
extra_compile_args=[
|
||||||
'-std=c++11',
|
'-std=c++11',
|
||||||
'-O3',
|
'-O3',
|
||||||
|
@ -32,10 +39,7 @@ setup(
|
||||||
author_email="Use the github issues",
|
author_email="Use the github issues",
|
||||||
url="https://github.com/stephan-hof/pyrocksdb",
|
url="https://github.com/stephan-hof/pyrocksdb",
|
||||||
license='BSD License',
|
license='BSD License',
|
||||||
install_requires=[
|
install_requires=['setuptools'],
|
||||||
'setuptools',
|
|
||||||
'Cython>=0.20',
|
|
||||||
],
|
|
||||||
package_dir={'rocksdb': 'rocksdb'},
|
package_dir={'rocksdb': 'rocksdb'},
|
||||||
packages=find_packages('.'),
|
packages=find_packages('.'),
|
||||||
ext_modules=cythonize([mod1]),
|
ext_modules=cythonize([mod1]),
|
||||||
|
|
Loading…
Add table
Reference in a new issue