Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the detection logic for MSYS2 #908

Merged
merged 6 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/pipx/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import sysconfig
from pathlib import Path
from textwrap import dedent
from typing import NewType, Optional
Expand Down Expand Up @@ -38,7 +39,12 @@ def is_windows() -> bool:
return sys.platform == "win32"


def is_mingw() -> bool:
return sysconfig.get_platform() == "mingw"


WINDOWS: bool = is_windows()
MINGW: bool = is_mingw()

completion_instructions = dedent(
"""
Expand Down
4 changes: 2 additions & 2 deletions src/pipx/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import pipx.constants
from pipx.animate import show_cursor
from pipx.constants import PIPX_TRASH_DIR, WINDOWS
from pipx.constants import MINGW, PIPX_TRASH_DIR, WINDOWS

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -115,7 +115,7 @@ def run_pypackage_bin(bin_path: Path, args: List[str]) -> NoReturn:
if WINDOWS:

def get_venv_paths(root: Path) -> Tuple[Path, Path]:
bin_path = root / "Scripts"
bin_path = root / "Scripts" if not MINGW else root / "bin"
python_path = bin_path / "python.exe"
return bin_path, python_path

Expand Down