Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: Minor change to pyghidra_launcher.py to better find python in a virtual environment on MSYS2 (#9496)

Ryan Kurtz2424807f3c2d
diff --git a/Ghidra/Features/PyGhidra/support/pyghidra_launcher.py b/Ghidra/Features/PyGhidra/support/pyghidra_launcher.py
index 965b610124..b5d3371103 100644
--- a/Ghidra/Features/PyGhidra/support/pyghidra_launcher.py
+++ b/Ghidra/Features/PyGhidra/support/pyghidra_launcher.py
@@ -125,9 +125,9 @@ def is_externally_managed() -> bool:
return marker.is_file()
def get_venv_exe(venv_dir: Path) -> List[str]:
- win_python_cmd: str = str(venv_dir / 'Scripts' / 'python.exe')
- linux_python_cmd: str = str(venv_dir / 'bin' / 'python3')
- return [win_python_cmd] if platform.system() == 'Windows' else [linux_python_cmd]
+ win_python_path: Path = venv_dir / 'Scripts' / 'python.exe'
+ linux_python_path: Path = venv_dir / 'bin' / 'python3' # also used by MSYS2 on Windows
+ return [str(win_python_path)] if win_python_path.exists() else [str(linux_python_path)]
def get_ghidra_venv(install_dir: Path, dev: bool) -> Path:
return (install_dir / 'build' if dev else get_user_settings_dir(install_dir, dev)) / 'venv'