Skip to content

Commit c5f0853

Browse files
AA-Turnervstinner
authored andcommitted
00460: pythongh-132415: Update vendored setuptools in Lib/test/wheeldata
(cherry picked from commit c9f3f5b) (actual changes in .whl files removed to make this patch smaller) pythongh-127906: Add missing sys import to test_cppext (cherry picked from commit 9cba148) Co-Authored-By: Victor Stinner <vstinner@python.org>
1 parent f5d3bbf commit c5f0853

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎Lib/test/support/__init__.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,7 +2361,7 @@ def _findwheel(pkgname):
23612361
filenames = os.listdir(wheel_dir)
23622362
filenames = sorted(filenames, reverse=True) # approximate "newest" first
23632363
for filename in filenames:
2364-
# filename is like 'setuptools-67.6.1-py3-none-any.whl'
2364+
# filename is like 'setuptools-{version}-py3-none-any.whl'
23652365
if not filename.endswith(".whl"):
23662366
continue
23672367
prefix = pkgname + '-'
@@ -2370,16 +2370,16 @@ def _findwheel(pkgname):
23702370
raise FileNotFoundError(f"No wheel for {pkgname} found in {wheel_dir}")
23712371

23722372

2373-
# Context manager that creates a virtual environment, install setuptools and wheel in it
2374-
# and returns the path to the venv directory and the path to the python executable
2373+
# Context manager that creates a virtual environment, install setuptools in it,
2374+
# and returns the paths to the venv directory and the python executable
23752375
@contextlib.contextmanager
2376-
def setup_venv_with_pip_setuptools_wheel(venv_dir):
2377-
import shlex
2376+
def setup_venv_with_pip_setuptools(venv_dir):
23782377
import subprocess
23792378
from .os_helper import temp_cwd
23802379

23812380
def run_command(cmd):
23822381
if verbose:
2382+
import shlex
23832383
print()
23842384
print('Run:', ' '.join(map(shlex.quote, cmd)))
23852385
subprocess.run(cmd, check=True)
@@ -2403,10 +2403,10 @@ def run_command(cmd):
24032403
else:
24042404
python = os.path.join(venv, 'bin', python_exe)
24052405

2406-
cmd = [python, '-X', 'dev',
2406+
cmd = (python, '-X', 'dev',
24072407
'-m', 'pip', 'install',
24082408
_findwheel('setuptools'),
2409-
_findwheel('wheel')]
2409+
)
24102410
run_command(cmd)
24112411

24122412
yield python

‎Lib/test/test_cext/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_build_limited_c11(self):
5050

5151
def check_build(self, extension_name, std=None, limited=False):
5252
venv_dir = 'env'
53-
with support.setup_venv_with_pip_setuptools_wheel(venv_dir) as python_exe:
53+
with support.setup_venv_with_pip_setuptools(venv_dir) as python_exe:
5454
self._check_build(extension_name, python_exe,
5555
std=std, limited=limited)
5656

‎Lib/test/test_cppext/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_build_limited(self):
4747

4848
def check_build(self, extension_name, std=None, limited=False):
4949
venv_dir = 'env'
50-
with support.setup_venv_with_pip_setuptools_wheel(venv_dir) as python_exe:
50+
with support.setup_venv_with_pip_setuptools(venv_dir) as python_exe:
5151
self._check_build(extension_name, python_exe,
5252
std=std, limited=limited)
5353

‎Lib/test/test_peg_generator/test_c_parser.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def setUpClass(cls):
9999
cls.addClassCleanup(shutil.rmtree, cls.library_dir)
100100

101101
with contextlib.ExitStack() as stack:
102-
python_exe = stack.enter_context(support.setup_venv_with_pip_setuptools_wheel("venv"))
102+
python_exe = stack.enter_context(support.setup_venv_with_pip_setuptools("venv"))
103103
sitepackages = subprocess.check_output(
104104
[python_exe, "-c", "import sysconfig; print(sysconfig.get_path('platlib'))"],
105105
text=True,

0 commit comments

Comments
 (0)