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 88
99from distutils .command .build_ext import build_ext
1010
11+ class NoCython (Exception ):
12+ pass
13+
1114try :
1215 import Cython .Compiler .Main as cython_compiler
1316 have_cython = True
@@ -24,10 +27,7 @@ def ensure_source(src):
2427
2528 if not os .path .exists (src ):
2629 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
3131 cythonize (pyx )
3232 elif (os .path .exists (pyx ) and
3333 os .stat (src ).st_mtime < os .stat (pyx ).st_mtime and
@@ -38,7 +38,14 @@ def ensure_source(src):
3838
3939class BuildExt (build_ext ):
4040 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
4249 return build_ext .build_extension (self , ext )
4350
4451
You can’t perform that action at this time.
0 commit comments