Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-146310: Fix ensurepip to treat empty WHEEL_PKG_DIR as unset#146357

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
kimimgo wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromkimimgo:fix/ensurepip-empty-wheel-pkg-dir-146310
Open
Show file tree
Hide file tree
Changes fromall 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
3 changes: 2 additions & 1 deletionLib/ensurepip/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,8 @@
# policies recommend against bundling dependencies. For example, Fedora
# installs wheel packages in the /usr/share/python-wheels/ directory and don't
# install the ensurepip._bundled package.
if (_pkg_dir := sysconfig.get_config_var('WHEEL_PKG_DIR')) is not None:
_pkg_dir = sysconfig.get_config_var('WHEEL_PKG_DIR')
if _pkg_dir:
_WHEEL_PKG_DIR = Path(_pkg_dir).resolve()
else:
_WHEEL_PKG_DIR = None
Expand Down
10 changes: 10 additions & 0 deletionsLib/test/test_ensurepip.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@
import unittest
import unittest.mock
from pathlib import Path
from test.support import import_helper

import ensurepip
import ensurepip._uninstall
Expand DownExpand Up@@ -36,6 +37,15 @@ def test_version_no_dir(self):
# when the bundled pip wheel is used, we get _PIP_VERSION
self.assertEqual(ensurepip._PIP_VERSION, ensurepip.version())

def test_wheel_pkg_dir_none(self):
# GH#146310: empty or None WHEEL_PKG_DIR should not search CWD
for value in ('', None):
with unittest.mock.patch('sysconfig.get_config_var',
return_value=value) as get_config_var:
module = import_helper.import_fresh_module('ensurepip')
self.assertIsNone(module._WHEEL_PKG_DIR)
get_config_var.assert_called_once_with('WHEEL_PKG_DIR')

def test_selected_wheel_path_no_dir(self):
pip_filename = f'pip-{ensurepip._PIP_VERSION}-py3-none-any.whl'
with unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', None):
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
The :mod:`ensurepip` module no longer looks for ``pip-*.whl`` wheel packages
in the current directory.
Loading

[8]ページ先頭

©2009-2026 Movatter.jp