8000 GH-80789: Get rid of the ``ensurepip`` infra for many wheels by webknjaz · Pull Request #109245 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-80789: Get rid of the ensurepip infra for many wheels #109245

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

Merged
merged 15 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Rename _find_packages to _get_replacement_pip_package
This change is intended to make it clear that the helper now only
returns one package and no more.

Co-Authored-By: vstinner@python.org
  • Loading branch information
webknjaz committed Jan 25, 2024
commit d6e51b2374628315afe2393a2124f1856a96d96b
6 changes: 3 additions & 3 deletions Lib/ensurepip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
_WHEEL_PKG_DIR = sysconfig.get_config_var('WHEEL_PKG_DIR')


def _find_packages(path: str | None) -> _Package:
def _get_replacement_pip_package(path: str | None) -> _Package:
if path is None:
raise LookupError(
'The compile-time `WHEEL_PKG_DIR` is unset so there is '
Expand Down Expand Up @@ -70,8 +70,8 @@ def _get_usable_pip_package() -> _Package:
pip_pkg = _Package(_PIP_VERSION, wheel_name, None)

with suppress(LookupError):
# only use the wheel package directory if all packages are found there
pip_pkg = _find_packages(_WHEEL_PKG_DIR)
# only use the wheel package directory if pip wheel is found there
pip_pkg = _get_replacement_pip_package(_WHEEL_PKG_DIR)

return pip_pkg

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ensurepip.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def setUp(self):
real_devnull = os.devnull
os_patch = unittest.mock.patch("ensurepip.os")
patched_os = os_patch.start()
# But expose os.listdir() used by _find_packages()
# But expose os.listdir() used by _get_replacement_pip_package()
patched_os.listdir = os.listdir
self.addCleanup(os_patch.stop)
patched_os.devnull = real_devnull
Expand Down
0