fix Anaconda Python detection on Windows

Anaconda prints version information on stderr instead of stdout.
This commit is contained in:
Samuel Sadok
2020-07-31 10:50:06 +02:00
parent a0bf270141
commit e1ffdbd33d
+2 -4
View File
@@ -6,9 +6,9 @@ tup.include('build.lua')
-- command "python --version" does not open the Microsoft Store.
-- On some systems this may return a python2 command if Python3 is not installed.
function find_python3()
success, python_version = run_now("python --version")
success, python_version = run_now("python --version 2>&1")
if success and string.match(python_version, "Python 3") then return "python -B" end
success, python_version = run_now("python3 --version")
success, python_version = run_now("python3 --version 2>&1")
if success and string.match(python_version, "Python 3") then return "python3 -B" end
error("Python 3 not found.")
end
@@ -16,8 +16,6 @@ end
python_command = find_python3()
print('Using python command "'..python_command..'"')
run_now("")
tup.frule{inputs={'fibre/cpp/interfaces_template.j2'}, command=python_command..' interface_generator_stub.py --definitions odrive-interface.yaml --template %f --output %o', outputs='autogen/interfaces.hpp'}
tup.frule{inputs={'fibre/cpp/function_stubs_template.j2'}, command=python_command..' interface_generator_stub.py --definitions odrive-interface.yaml --template %f --output %o', outputs='autogen/function_stubs.hpp'}
tup.frule{inputs={'fibre/cpp/endpoints_template.j2'}, command=python_command..' interface_generator_stub.py --definitions odrive-interface.yaml --generate-endpoints ODrive --template %f --output %o', outputs='autogen/endpoints.hpp'}