harmonization with python var names (lua_path --> lua_bin)

This commit is contained in:
2026-01-25 15:10:10 +01:00
parent 33c45fae29
commit 7be413779b
7 changed files with 37 additions and 37 deletions

View File

@@ -17,8 +17,8 @@ plot_log_path: /tmp/testium_plot/$(testrun_date)/$(testrun_time)/
python_path_Windows: C:\Users\François\Applications\Python313\python.exe
python_path_Linux: $(home)/tmp/tum_venv/bin/python3
# lua_path_Windows: C:\Lua\5.1
# lua_path_Linux: /usr/bin/lua
# lua_bin_Windows: C:\Lua\5.1
# lua_bin_Linux: /usr/bin/lua
LUA_PATH_Linux: /usr/share/lua/5.4/?.lua;/usr/local/share/lua/5.4/?.lua;/usr/local/share/lua/5.4/?/init.lua;/usr/share/lua/5.4/?/init.lua;/usr/local/lib/lua/5.4/?.lua;/usr/local/lib/lua/5.4/?/init.lua;/usr/lib/lua/5.4/?.lua;/usr/lib/lua/5.4/?/init.lua;./?.lua;./?/init.lua;/home/francois/.luarocks/share/lua/5.4/?.lua;/home/francois/.luarocks/share/lua/5.4/?/init.lua
LUA_CPATH_Linux: /usr/local/lib/lua/5.4/?.so;/usr/lib/lua/5.4/?.so;/usr/local/lib/lua/5.4/loadall.so;/usr/lib/lua/5.4/loadall.so;./?.so;/home/francois/.luarocks/lib/lua/5.4/?.so

View File

@@ -68,7 +68,7 @@ value of the funcToBeExecuted python function.
Some global variables have an impact on the ``lua_func`` test item behavior:
* ``lua_path``: This optional global variable can be used to define
* ``lua_bin``: This optional global variable can be used to define
the lua executable path. If not defined, the lua interpreter is
searched in at the default place in the system.
* ``lua_env``: This global variable can be used to define

View File

@@ -33,7 +33,7 @@ class TestItemLuaFunc(TestItem):
self.seqFilename(),
)
# Lua functions call subprocess initialization
self._proc = lua_func_call_init(tm.gd("lua_path", ""), api_request, 10)
self._proc = lua_func_call_init(tm.gd("lua_bin", ""), api_request, 10)
@test_run
@@ -56,7 +56,7 @@ class TestItemLuaFunc(TestItem):
raise ETUMRuntimeError(
f"""Impossible to start the external lua execution process.
Is the lua path correct ?
lua_path = {tm.gd("lua_path", "no lua path defined")}
lua_bin = {tm.gd("lua_bin", "no lua path defined")}
Are "lua-sockets" and "lua-cjson" installed ?
Is the lua environnment well defined in the "LUA_PATH" and "LUA_CPATH" variables ?"""
)

View File

@@ -36,18 +36,18 @@ def _lua_version(path: str):
def _is_lua51(lua_path):
def _is_lua51(lua_bin):
res = False
v = _lua_version(lua_path)
v = _lua_version(lua_bin)
if (v[0] == "5") and (v[1] >= "1"):
res = True
return res
def _sys_lua_path():
sys_lua_path = tm.gd("_sys_lua_path", "")
if sys_lua_path != "":
return sys_lua_path
def _sys_lua_bin():
sys_lua_bin = tm.gd("_sys_lua_bin", "")
if sys_lua_bin != "":
return sys_lua_bin
cur_os = tm.OS()
if cur_os == "Windows":
@@ -55,22 +55,22 @@ def _sys_lua_path():
else:
func = sys_app_path_lin
sys_lua_path = func("lua")
if (sys_lua_path != "") and not _is_lua51(sys_lua_path):
tm.print_debug(f"'{sys_lua_path}' not a lua 5.1 min.")
sys_lua_path = ""
sys_lua_bin = func("lua")
if (sys_lua_bin != "") and not _is_lua51(sys_lua_bin):
tm.print_debug(f"'{sys_lua_bin}' not a lua 5.1 min.")
sys_lua_bin = ""
tm.setgd("_sys_lua_path", sys_lua_path)
return sys_lua_path
tm.setgd("_sys_lua_bin", sys_lua_bin)
return sys_lua_bin
def lua_func_call_init(lua_path, request_handler, timeout):
def lua_func_call_init(lua_bin, request_handler, timeout):
"""
Initializes the global Lua function execution process.
Args:
lua_path (str): Path to the Lua interpreter executable. If empty, uses system default.
lua_bin (str): Path to the Lua interpreter executable. If empty, uses system default.
request_handler: Handler for JSON-RPC requests.
timeout (int): Timeout for operations in seconds.
@@ -81,7 +81,7 @@ def lua_func_call_init(lua_path, request_handler, timeout):
ETUMRuntimeError: If the Lua path is invalid or no interpreter is found.
"""
global function_call_process
function_call_process = LuaFuncExecEngine(lua_path, request_handler, timeout)
function_call_process = LuaFuncExecEngine(lua_bin, request_handler, timeout)
return function_call_process
@@ -117,37 +117,37 @@ class LuaFuncExecEngine:
and executes specified functions with parameters.
"""
def __init__(self, lua_path="", request_handler=None, timeout=10):
def __init__(self, lua_bin="", request_handler=None, timeout=10):
"""
Initializes the Lua function execution engine.
Args:
lua_path (str, optional): Path to the Lua interpreter. Defaults to system path.
lua_bin (str, optional): Path to the Lua interpreter. Defaults to system path.
request_handler: Handler for JSON-RPC requests.
timeout (int, optional): Timeout for operations in seconds. Defaults to 10.
Raises:
ETUMRuntimeError: If the Lua path is invalid or no interpreter is found.
"""
if lua_path != "":
if shutil.which(lua_path) is None:
if lua_bin != "":
if shutil.which(lua_bin) is None:
raise ETUMRuntimeError(
f"The passed lua path is not pointing to an executable: '{lua_path}'"
f"The passed lua path is not pointing to an executable: '{lua_bin}'"
)
if not is_lua_interpreter(lua_path):
if not is_lua_interpreter(lua_bin):
raise ETUMRuntimeError(
f"The passed executable is not a lua interpreter: '{lua_path}'"
f"The passed executable is not a lua interpreter: '{lua_bin}'"
)
else:
lua_path = _sys_lua_path()
if lua_path == "":
lua_bin = _sys_lua_bin()
if lua_bin == "":
raise ETUMRuntimeError(
f"No valid lua interpreter found"
)
tm.setgd("lua_path", lua_path)
tm.setgd("lua_bin", lua_bin)
self._lpath = lua_path
self._lpath = lua_bin
self._req_handler = request_handler
self._process = None
self._port = 0

View File

@@ -271,10 +271,10 @@ class TestiumSettings():
# SettingsLuaPath = 'luaPath'
@property
def lua_path(self):
def lua_bin(self):
r = self.value(self.SettingsLuaPath, "")
return r
@lua_path.setter
def lua_path(self, value):
@lua_bin.setter
def lua_bin(self, value):
self.set_value(self.SettingsLuaPath, value)

View File

@@ -108,7 +108,7 @@ class PrefWindow(QDialog):
prefs.settings.SettingsLuaPath: {
"type": "text",
"widget": self.ui.editLuaPath,
"value": prefs.settings.lua_path,
"value": prefs.settings.lua_bin,
"default": "",
"changed": False,
},

View File

@@ -981,9 +981,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if pp != "":
d["python_bin"] = pp
pp = prefs.settings.lua_path
pp = prefs.settings.lua_bin
if pp != "":
d["lua_path"] = pp
d["lua_bin"] = pp
return d