File tree 1 file changed +6
-20
lines changed
1 file changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -22,38 +22,24 @@ class NoCython(Exception):
22
22
23
23
24
24
def cythonize (src ):
25
+ if not have_cython :
26
+ raise Exception ("Cython is required for building from checkout" )
25
27
sys .stderr .write (f"cythonize: { src !r} \n " )
26
28
cython_compiler .compile ([src ], cplus = True )
27
29
28
30
29
31
def ensure_source (src ):
30
32
pyx = os .path .splitext (src )[0 ] + ".pyx"
31
33
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 :
35
35
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
39
36
40
37
41
38
class BuildExt (build_ext ):
42
39
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 )
57
43
58
44
59
45
# Cython is required for sdist
You can’t perform that action at this time.
0 commit comments