update script to use virtual environment
This commit is contained in:
parent
5260564aaf
commit
f0237be035
@ -15,13 +15,30 @@ function callback(success, result, error)
|
||||
end
|
||||
|
||||
local function get_python_command()
|
||||
-- Determine OS type
|
||||
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
|
||||
-- Windows
|
||||
return "python"
|
||||
script_dir = script_path:match("(.+)\\[^\\]+$") or "."
|
||||
else
|
||||
-- Linux
|
||||
return "python3"
|
||||
-- Unix
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user