From 2d1037654fe37395f33b5d63ee897a2d2207fa93 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 2 Jul 2023 06:52:40 -0400 Subject: [PATCH] Pass system flag to pyhon which --- pipenv/project.py | 5 ++--- pipenv/utils/project.py | 2 +- pipenv/utils/resolver.py | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pipenv/project.py b/pipenv/project.py index 35cc7f2f..f865988b 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -1155,12 +1155,11 @@ class Project: result = str(result.path) return result - @property - def python(self) -> str: + def python(self, system=False) -> str: """Path to the project python""" from pipenv.utils.shell import project_python - return project_python(self) + return project_python(self, system=system) def _which(self, command, location=None, allow_global=False): if not allow_global and location is None: diff --git a/pipenv/utils/project.py b/pipenv/utils/project.py index d95ba5cb..a0cfb10f 100644 --- a/pipenv/utils/project.py +++ b/pipenv/utils/project.py @@ -79,4 +79,4 @@ def ensure_project( skip_requirements=skip_requirements, system=system, ) - os.environ["PIP_PYTHON_PATH"] = project.python + os.environ["PIP_PYTHON_PATH"] = project.python(system=system) diff --git a/pipenv/utils/resolver.py b/pipenv/utils/resolver.py index 2bff3f55..f4c41df5 100644 --- a/pipenv/utils/resolver.py +++ b/pipenv/utils/resolver.py @@ -1166,7 +1166,7 @@ def resolve_deps( req_dir = req_dir if req_dir else os.environ.get("req_dir", None) if not req_dir: req_dir = create_tracked_tempdir(prefix="pipenv-", suffix="-requirements") - with HackedPythonVersion(python_path=project.python): + with HackedPythonVersion(python_path=project.python(system=allow_global)): try: results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps( deps, @@ -1185,7 +1185,7 @@ def resolve_deps( # Second (last-resort) attempt: if results is None: with HackedPythonVersion( - python_path=project.python, + python_path=project.python(system=allow_global), ): try: # Attempt to resolve again, with different Python version information,