forked from talkiq/yaaredis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
33 lines (25 loc) · 824 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
import traceback
from setuptools import Extension
from setuptools.command.build_ext import build_ext
ext_modules = [
Extension('yaaredis.speedups', sources=['yaaredis/speedups.c']),
]
class SafeBuildExt(build_ext):
def run(self):
try:
build_ext.run(self)
except Exception:
print('Could not compile C extension.')
traceback.print_exc()
def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except Exception:
print('Could not compile C extension.')
traceback.print_exc()
def build(setup_kwargs):
"""
This function is mandatory in order to build the extensions.
"""
setup_kwargs['ext_modules'] = ext_modules
setup_kwargs['cmdclass'] = {'build_ext': SafeBuildExt}