From aa5ca0708ef4e6178605a81f0dde139575b80664 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Thu, 19 Sep 2024 13:10:52 +0200 Subject: [PATCH] Try to fix/workaround CI failure --- fawltydeps/packages.py | 2 +- fawltydeps/types.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fawltydeps/packages.py b/fawltydeps/packages.py index 2a86cf3a..672c06ac 100644 --- a/fawltydeps/packages.py +++ b/fawltydeps/packages.py @@ -347,7 +347,7 @@ def debug_print(msg: str) -> None: if found: return - elif bin_python.is_file(): # Assume POSIX + elif bin_python.is_file() or bin_python.is_symlink(): # Assume POSIX debug_print(" - on posix, found bin/python") if bin_python.is_symlink() and hasattr(bin_python, "readlink"): debug_print(f" and points to {bin_python.readlink()!r}") diff --git a/fawltydeps/types.py b/fawltydeps/types.py index b314d06a..dabfe63b 100644 --- a/fawltydeps/types.py +++ b/fawltydeps/types.py @@ -154,6 +154,8 @@ def __post_init__(self) -> None: super().__post_init__() assert self.path.is_dir() # noqa: S101, sanity check + bin_python = self.path.parent.parent.parent / "bin/python" + # Support Windows projects if sys.platform.startswith("win"): if ( @@ -162,9 +164,8 @@ def __post_init__(self) -> None: ): return # also ok # Support vitualenvs, poetry2nix envs, system-wide installs, etc. - elif ( - self.path.match("lib/python?.*/site-packages") - and (self.path.parent.parent.parent / "bin/python").is_file() + elif self.path.match("lib/python?.*/site-packages") and ( + bin_python.is_file() or bin_python.is_symlink() ): return # all ok