Skip to content

Commit

Permalink
Properly avoid pipx venv path to be included in altered path warning (
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysle committed Sep 19, 2023
1 parent d0162aa commit 1cdfc55
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ansiblelint/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,20 @@ def path_inject() -> None:
inject_paths = []

userbase_bin_path = Path(site.getuserbase()) / "bin"

if (
str(userbase_bin_path) not in paths
and (userbase_bin_path / "bin" / "ansible").exists()
and "pipx" not in str(userbase_bin_path)
):
inject_paths.append(str(userbase_bin_path))

py_path = Path(sys.executable).parent
if str(py_path) not in paths and (py_path / "ansible").exists():
pipx_path = os.environ.get("PIPX_HOME", "pipx")
if (
str(py_path) not in paths
and (py_path / "ansible").exists()
and pipx_path not in str(py_path)
):
inject_paths.append(str(py_path))

if not os.environ.get("PYENV_VIRTUAL_ENV", None):
Expand Down

0 comments on commit 1cdfc55

Please sign in to comment.