summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools/find_python.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/detect/tools/find_python.lua')
-rw-r--r--xmake/modules/detect/tools/find_python.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/modules/detect/tools/find_python.lua b/xmake/modules/detect/tools/find_python.lua
index cc2645a6f..d4097e4c9 100644
--- a/xmake/modules/detect/tools/find_python.lua
+++ b/xmake/modules/detect/tools/find_python.lua
@@ -25,6 +25,8 @@
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
+import("detect.tools.find_python2")
+import("detect.tools.find_python3")
-- find python
--
@@ -46,10 +48,13 @@ function main(opt)
-- find program
local program = find_program(opt.program or "python", opt)
+ if not program then
+ program = find_python3() or find_python2()
+ end
-- find program version
local version = nil
- if program and opt and opt.version then
+ if program and opt.version then
opt.command = function ()
local outs, errs = os.iorunv(program, {"--version"})
return ((outs or "") .. (errs or "")):trim()