Skip to content

Commit dff4e47

Browse files
committed
py_lua_helper: added logic for detecting lua binary path on windows
1 parent c3b12b1 commit dff4e47

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

python_lua_helper/py_lua_helper.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,29 @@ def _detect_lua_binary(self):
170170
raise ValueError(
171171
f"Lua binary does not meet version requirements: {self.lua_binary}"
172172
)
173-
174173
# Probe for available Lua binaries
175-
lua_hints = ["lua", "lua5.4", "lua54", "lua5.3", "lua53", "lua5.2", "lua52", "lua5.1", "lua51"]
174+
lua_hints = [
175+
"lua",
176+
"lua5.4",
177+
"lua54",
178+
"lua5.3",
179+
"lua53",
180+
"lua5.2",
181+
"lua52",
182+
"lua5.1",
183+
"lua51",
184+
]
185+
bin_suffix = ""
186+
if os.name == "nt":
187+
bin_suffix = ".exe"
176188
for hint in lua_hints:
177189
try:
178-
lua_path = shutil.which(hint)
190+
lua_path = shutil.which(f"{hint}{bin_suffix}")
179191
if lua_path and self._validate_lua_version(lua_path):
180192
self.lua_binary = os.path.abspath(lua_path)
181193
return
182194
except Exception:
183195
continue
184-
185196
raise RuntimeError("Failed to detect compatible Lua interpreter")
186197

187198
def _validate_lua_version(self, lua_binary: str) -> bool:

0 commit comments

Comments
 (0)