20
20
21
21
rule (" python.cython" )
22
22
set_extensions (" .py" , " .pyx" )
23
- on_load (function (target )
23
+
24
+ on_load (function (target )
24
25
local language = target :extraconf (" rules" , " python.cython" , " language" )
25
26
if language == " c" then
26
27
target :add (" deps" , " c" )
27
28
elseif language == " c++" then
28
29
target :add (" deps" , " c++" )
29
30
end
30
31
end )
31
- before_buildcmd_file (function (target , batchcmds , sourcefile , opt )
32
+
33
+ before_buildcmd_file (function (target , batchcmds , sourcefile , opt )
32
34
import (" lib.detect.find_tool" )
35
+
36
+ local cython = assert (find_tool (" cython" ), " cython not found! please `pip install cython`." )
33
37
local language = target :extraconf (" rules" , " python.cython" , " language" )
34
38
local ext
35
39
local arg = " -3"
@@ -49,10 +53,7 @@ rule("python.cython")
49
53
-- add commands
50
54
batchcmds :show_progress (opt .progress , " ${color.build.object}compiling.python %s" , sourcefile )
51
55
batchcmds :mkdir (path .directory (sourcefile_c ))
52
- local cython = find_tool (" cython" )
53
- assert (cython , " cython not found! please `pip install cython`." )
54
- batchcmds :vrunv (cython .program ,
55
- { arg , " -o" , path (sourcefile_c ), path (sourcefile ) })
56
+ batchcmds :vrunv (cython .program , {arg , " -o" , path (sourcefile_c ), path (sourcefile )})
56
57
batchcmds :compile (sourcefile_c , objectfile )
57
58
58
59
-- add deps
0 commit comments