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

Pass system flag to python which #5773

Merged
merged 1 commit into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 2 additions & 3 deletions pipenv/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,12 +1155,11 @@ def which(self, search, as_path=True):
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:
Expand Down
2 changes: 1 addition & 1 deletion pipenv/utils/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions pipenv/utils/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down