update script to use virtual environment
This commit is contained in:
@@ -15,13 +15,30 @@ function callback(success, result, error)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function get_python_command()
|
local function get_python_command()
|
||||||
|
-- Determine OS type
|
||||||
local os_name = package.config:sub(1, 1)
|
local os_name = package.config:sub(1, 1)
|
||||||
|
|
||||||
|
-- Get the path to this Lua file
|
||||||
|
local info = debug.getinfo(1, "S")
|
||||||
|
local script_path = info.source:sub(info.source:find("@") == 1 and 2 or 1)
|
||||||
|
|
||||||
|
-- Extract the directory containing this file
|
||||||
|
local script_dir
|
||||||
if os_name == "\\" then
|
if os_name == "\\" then
|
||||||
-- Windows
|
-- Windows
|
||||||
return "python"
|
script_dir = script_path:match("(.+)\\[^\\]+$") or "."
|
||||||
else
|
else
|
||||||
-- Linux
|
-- Unix
|
||||||
return "python3"
|
script_dir = script_path:match("(.+)/[^/]+$") or "."
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Build absolute path to the Python executable in the virtual environment
|
||||||
|
if os_name == "\\" then
|
||||||
|
-- Windows
|
||||||
|
return script_dir .. "\\env\\Scripts\\python.exe"
|
||||||
|
else
|
||||||
|
-- Unix
|
||||||
|
return script_dir .. "/env/bin/python3"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user