Skip to content

Commit 92cdead

Browse files
waruqiFreed-Wu
authored andcommitted
Update xmake.lua
1 parent 22e9730 commit 92cdead

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

xmake/rules/python/cython/xmake.lua

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,20 @@
2020

2121
rule("python.cython")
2222
set_extensions(".py", ".pyx")
23-
on_load(function(target)
23+
24+
on_load(function (target)
2425
local language = target:extraconf("rules", "python.cython", "language")
2526
if language == "c" then
2627
target:add("deps", "c")
2728
elseif language == "c++" then
2829
target:add("deps", "c++")
2930
end
3031
end)
31-
before_buildcmd_file(function(target, batchcmds, sourcefile, opt)
32+
33+
before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
3234
import("lib.detect.find_tool")
35+
36+
local cython = assert(find_tool("cython"), "cython not found! please `pip install cython`.")
3337
local language = target:extraconf("rules", "python.cython", "language")
3438
local ext
3539
local arg = "-3"
@@ -49,10 +53,7 @@ rule("python.cython")
4953
-- add commands
5054
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.python %s", sourcefile)
5155
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)})
5657
batchcmds:compile(sourcefile_c, objectfile)
5758

5859
-- add deps

0 commit comments

Comments
 (0)