-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathsetup.py
33 lines (28 loc) · 1.09 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from setuptools import setup
from setuptools.extension import Extension
try:
# Only use Cython if it's installed in the environment, otherwise use the provided C
import Cython # noqa: F401
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
ext = '.pyx' if USE_CYTHON else '.c'
extensions = [
Extension('jsonobject.api', ["jsonobject/api" + ext],),
Extension('jsonobject.base', ["jsonobject/base" + ext],),
Extension('jsonobject.base_properties', ["jsonobject/base_properties" + ext],),
Extension('jsonobject.containers', ["jsonobject/containers" + ext],),
Extension('jsonobject.properties', ["jsonobject/properties" + ext],),
Extension('jsonobject.utils', ["jsonobject/utils" + ext],),
]
if USE_CYTHON:
from Cython.Build import cythonize
extensions = cythonize(extensions, compiler_directives={"language_level" : "3str"})
else:
print("You are running without Cython installed. It is highly recommended to run\n"
" ./scripts/install_cython.sh\n"
"before you continue")
setup(
name='jsonobject',
ext_modules=extensions,
)