forked from eladyaniv01/SC2MapAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.py
38 lines (29 loc) · 907 Bytes
/
build.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
"""Build script."""
from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
import numpy
from setuptools import Extension
from setuptools.command.build_ext import build_ext
extensions = [
Extension(
"mapanalyzerext",
sources=["extension/ma_ext.c"],
include_dirs=[numpy.get_include()],
),
]
class BuildFailed(Exception):
pass
class ExtBuilder(build_ext):
def run(self):
try:
build_ext.run(self)
except (DistutilsPlatformError, FileNotFoundError):
pass
def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except (CCompilerError, DistutilsExecError, DistutilsPlatformError, ValueError):
pass
def build(setup_kwargs):
setup_kwargs.update(
{"ext_modules": extensions, "cmdclass": {"build_ext": ExtBuilder}}
)