diff options
| -rw-r--r-- | tools/build_gui.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/build_gui.py b/tools/build_gui.py index e912d8d..c9811a3 100644 --- a/tools/build_gui.py +++ b/tools/build_gui.py @@ -10,7 +10,7 @@ except ImportError: sys.exit(1) -def find_libffi_dll() -> str | None: +def find_libffi_dll() -> tuple[str | None, list[str]]: """ Find the libffi-*.dll file required for _ctypes on Windows. @@ -18,9 +18,13 @@ def find_libffi_dll() -> str | None: 1. The active Python environment's DLLs directory. 2. The base Python installation's DLLs directory (if in a venv). 3. A Conda environment's Library/bin directory. + + Returns: + A tuple containing the path to the DLL (or None) and a list of + directories that were searched. """ if sys.platform != "win32": - return None + return None, [] search_paths = [] # 1. Active environment's DLLs directory (sys.prefix is the venv path) @@ -45,9 +49,9 @@ def find_libffi_dll() -> str | None: if found_dlls: dll_path = found_dlls[0] print(f" - Found: {dll_path}") - return dll_path + return dll_path, unique_paths - return None + return None, unique_paths def main() -> None: @@ -67,7 +71,7 @@ def main() -> None: ] if sys.platform == "win32": - libffi_path = find_libffi_dll() + libffi_path, searched_paths = find_libffi_dll() if libffi_path: # The format for --add-binary is "source;destination" on Windows. # We add the DLL to the root of the bundle. @@ -76,8 +80,8 @@ def main() -> None: print("\nERROR: Could not find libffi-*.dll on Windows.") print("This DLL is required for the _ctypes module to work correctly.") print("Searched in the following directories:") - for path in sorted(list(set(p for p in search_paths if os.path.isdir(p)))): - print(f" - {path}") + for path in searched_paths: + print(f" - {path}") print("Please ensure you are using a standard CPython or Conda installation.") sys.exit(1) |
