Skip to content

Commit 9588222

Browse files
authored
env: fix global pip (#746)
* Fix invoking outer pip from user site packages * Specify minimum pip version required for outer pip * Update changelog
1 parent da06973 commit 9588222

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ Changelog
33
+++++++++
44

55

6-
next release
7-
============
6+
1.1.1 (2024-02-29)
7+
==================
8+
9+
- Fixed invoking outer pip from user site packages
10+
(PR :pr:`746`, fixes issue :issue:`745`)
11+
- Corrected the minimum pip version required to use an outer pip
12+
(PR :pr:`746`, fixes issue :issue:`745`)
813

9-
Python 3.7 (past EoL) support will be removed.
1014

1115
1.1.0 (2024-02-29)
1216
==================

src/build/env.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _minimum_pip_version() -> str:
7070
return '19.1.0'
7171

7272

73-
def _has_valid_pip(**distargs: object) -> bool:
73+
def _has_valid_pip(__version: str | None = None, **distargs: object) -> bool:
7474
"""
7575
Given a path, see if Pip is present and return True if the version is
7676
sufficient for build, False if it is not. ModuleNotFoundError is thrown if
@@ -90,7 +90,7 @@ def _has_valid_pip(**distargs: object) -> bool:
9090

9191
current_pip_version = packaging.version.Version(pip_distribution.version)
9292

93-
return current_pip_version >= packaging.version.Version(_minimum_pip_version())
93+
return current_pip_version >= packaging.version.Version(__version or _minimum_pip_version())
9494

9595

9696
@functools.lru_cache(maxsize=None)
@@ -101,7 +101,8 @@ def _valid_global_pip() -> bool | None:
101101
"""
102102

103103
try:
104-
return _has_valid_pip()
104+
# Version to have added the `--python` option.
105+
return _has_valid_pip('22.3')
105106
except ModuleNotFoundError:
106107
return None
107108

@@ -157,7 +158,7 @@ def python_executable(self) -> str:
157158

158159
def _pip_args(self) -> list[str]:
159160
if _valid_global_pip():
160-
return [sys.executable, '-Im', 'pip', '--python', self.python_executable]
161+
return [sys.executable, '-m', 'pip', '--python', self.python_executable]
161162
else:
162163
return [self.python_executable, '-Im', 'pip']
163164

0 commit comments

Comments
 (0)