fix: Xilinx 2018.3 tool discovery — add SDK dir, .bat PATH search, older versions

This commit is contained in:
2026-06-12 17:20:49 +08:00
parent 47ea614ba2
commit e09f16a3aa
+17 -10
View File
@@ -60,7 +60,8 @@ TOOL_ALIASES: dict[str, list[str]] = {
}
# Product subdirectories under xilinx_root to scan (in preference order)
_PRODUCT_DIRS = ("Vitis", "Vivado")
# SDK covers pre-2019 installations where xsct lived in SDK/*/bin/
_PRODUCT_DIRS = ("Vitis", "Vivado", "SDK")
# ── Version helpers ──────────────────────────────────────────────────
@@ -163,9 +164,9 @@ def _find_executable(
"""Find an executable by name using PATH, Vitis, and Xilinx root.
Search order:
1. System PATH (shutil.which)
1. System PATH (shutil.which) — tries bare name, .exe, .bat on Windows
2. vitis_path/bin (legacy config)
3. xilinx_root/Vitis/*/bin and Vivado/*/bin — pick NEWEST version
3. xilinx_root/Vitis/*/bin, Vivado/*/bin, SDK/*/bin — pick NEWEST version
4. Common install paths (cross-platform)
Args:
@@ -179,16 +180,22 @@ def _find_executable(
"""
exec_suffix = ".exe" if system == "windows" else ""
# 1. System PATH
found = shutil.which(f"{exec_name}{exec_suffix}")
# 1. System PATH — search without explicit extension first
# so Windows PATHEXT resolves .bat/.exe/.cmd automatically
found = shutil.which(exec_name)
if not found and exec_suffix:
found = shutil.which(f"{exec_name}{exec_suffix}")
if not found:
found = shutil.which(f"{exec_name}.bat")
if found:
return found
# 2. Legacy vitis_path/bin
if vitis_path:
candidate = Path(vitis_path) / "bin" / f"{exec_name}{exec_suffix}"
if candidate.is_file():
return str(candidate)
for sfx in (".bat", ".exe") if system == "windows" else (exec_suffix,):
candidate = Path(vitis_path) / "bin" / f"{exec_name}{sfx}"
if candidate.is_file():
return str(candidate)
# 3. Scan xilinx_root — pick newest version across Vitis + Vivado
if xilinx_root:
@@ -203,8 +210,8 @@ def _find_executable(
if system == "windows":
common: list[str] = []
for sfx in (".bat", ".exe"):
for ver in ("2023.2", "2022.2"):
for prod in ("Vitis", "Vivado"):
for ver in ("2023.2", "2022.2", "2018.3"):
for prod in ("Vitis", "Vivado", "SDK"):
common.append(f"C:/Xilinx/{prod}/{ver}/bin/{exec_name}{sfx}")
else:
common = [