-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
46 lines (39 loc) · 1.25 KB
/
setup.py
File metadata and controls
46 lines (39 loc) · 1.25 KB
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
43
44
45
46
#!/usr/bin/python3
from setuptools import setup,find_packages
from setuptools.extension import Extension
from distutils.command.sdist import sdist as _sdist
try:
from Cython.Distutils import build_ext
use_cython = True
except ImportError:
use_cython = False
cmdclass = {}
if use_cython:
extensions = [
Extension("LEDSerialExpander", ["src/LEDSerialExpander.pyx"])
]
cmdclass['build_ext'] = build_ext
else:
extensions = [
Extension("LEDSerialExpander", ["src/LEDSerialExpander.c"])
]
class sdist(_sdist):
def run(self):
# Make sure the compiled Cython files in the distribution are up-to-date
from Cython.Build import cythonize
cythonize(extensions, compiler_directives={'language_level' : "3"})
_sdist.run(self)
cmdclass['sdist'] = sdist
with open("requirements.txt") as fp:
install_requires = fp.read().strip().split("\n")
setup(
name = "LEDSerialExpander",
url="https://github.com/branko623/LEDSerialExpander",
author = "Branko Mirkovic",
author_email = "branko623@gmail.com",
description = "Expander Board Python Driver",
packages = find_packages(),
ext_modules=extensions,
cmdclass = cmdclass,
install_requires=install_requires
)