File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 8
8
9
9
from distutils .command .build_ext import build_ext
10
10
11
+ class NoCython (Exception ):
12
+ pass
13
+
11
14
try :
12
15
import Cython .Compiler .Main as cython_compiler
13
16
have_cython = True
@@ -24,10 +27,7 @@ def ensure_source(src):
24
27
25
28
if not os .path .exists (src ):
26
29
if not have_cython :
27
- raise Exception ("""\
28
- Cython is required for building extension from checkout.
29
- Install Cython >= 0.16 or install msgpack from PyPI.
30
- """ )
30
+ raise NoCython
31
31
cythonize (pyx )
32
32
elif (os .path .exists (pyx ) and
33
33
os .stat (src ).st_mtime < os .stat (pyx ).st_mtime and
@@ -38,7 +38,14 @@ def ensure_source(src):
38
38
39
39
class BuildExt (build_ext ):
40
40
def build_extension (self , ext ):
41
- ext .sources = list (map (ensure_source , ext .sources ))
41
+ try :
42
+ ext .sources = list (map (ensure_source , ext .sources ))
43
+ except NoCython :
44
+ print "WARNING"
45
+ print "Cython is required for building extension from checkout."
46
+ print "Install Cython >= 0.16 or install msgpack from PyPI."
47
+ print "Falling back to pure Python implementation."
48
+ return
42
49
return build_ext .build_extension (self , ext )
43
50
44
51
You can’t perform that action at this time.
0 commit comments