File tree Expand file tree Collapse file tree 1 file changed +6
-20
lines changed Expand file tree Collapse file tree 1 file changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -22,38 +22,24 @@ class NoCython(Exception):
2222
2323
2424def cythonize (src ):
25+ if not have_cython :
26+ raise Exception ("Cython is required for building from checkout" )
2527 sys .stderr .write (f"cythonize: { src !r} \n " )
2628 cython_compiler .compile ([src ], cplus = True )
2729
2830
2931def ensure_source (src ):
3032 pyx = os .path .splitext (src )[0 ] + ".pyx"
3133
32- if not os .path .exists (src ):
33- if not have_cython :
34- raise NoCython
34+ if not os .path .exists (src ) or have_cython and os .stat (src ).st_mtime < os .stat (pyx ).st_mtime :
3535 cythonize (pyx )
36- elif os .path .exists (pyx ) and os .stat (src ).st_mtime < os .stat (pyx ).st_mtime and have_cython :
37- cythonize (pyx )
38- return src
3936
4037
4138class BuildExt (build_ext ):
4239 def build_extension (self , ext ):
43- try :
44- ext .sources = list (map (ensure_source , ext .sources ))
45- except NoCython :
46- print ("WARNING" )
47- print ("Cython is required for building extension from checkout." )
48- print ("Install Cython >= 0.16 or install msgpack from PyPI." )
49- print ("Falling back to pure Python implementation." )
50- return
51- try :
52- return build_ext .build_extension (self , ext )
53- except Exception as e :
54- print ("WARNING: Failed to compile extension modules." )
55- print ("msgpack uses fallback pure python implementation." )
56- print (e )
40+ for src in ext .sources :
41+ ensure_source (src )
42+ return build_ext .build_extension (self , ext )
5743
5844
5945# Cython is required for sdist
You can’t perform that action at this time.
0 commit comments