forked from GregDMeyer/IT8951
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
42 lines (34 loc) · 866 Bytes
/
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
34
35
36
37
38
39
40
41
42
from os import environ
from setuptools import setup, Extension
# check python version
from sys import version_info
if version_info[0] != 3:
raise RuntimeError("This module is written for Python 3.")
# use this option if you want to rebuild the .c file yourself with cython
# enable by setting "USE_CYTHON" environment variable before building
USE_CYTHON = 'USE_CYTHON' in environ
if USE_CYTHON:
ext = '.pyx'
else:
ext = '.c'
ext_names = [
'spi',
'img_manip',
]
extensions = []
for name in ext_names:
extensions.append(
Extension(
"IT8951.{}".format(name),
["IT8951/{}{}".format(name, ext)],
)
)
if USE_CYTHON:
from Cython.Build import cythonize
extensions = cythonize(extensions)
setup(
name='IT8951',
packages=['IT8951'],
version='0.1.0',
ext_modules=extensions,
)