Skip to content

Commit feebd7c

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 eb7eaa9 commit feebd7c

5 files changed

Lines changed: 11 additions & 10 deletions

File tree

‎Lib/test/support/__init__.py‎

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

23712371

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

23802379
def run_command(cmd):
23812380
if verbose:
2381+
import shlex
23822382
print()
23832383
print('Run:', ' '.join(map(shlex.quote, cmd)))
23842384
subprocess.run(cmd, check=True)
@@ -2402,10 +2402,10 @@ def run_command(cmd):
24022402
else:
24032403
python = os.path.join(venv, 'bin', python_exe)
24042404

2405-
cmd = [python, '-X', 'dev',
2405+
cmd = (python, '-X', 'dev',
24062406
'-m', 'pip', 'install',
24072407
_findwheel('setuptools'),
2408-
_findwheel('wheel')]
2408+
)
24092409
run_command(cmd)
24102410

24112411
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_cppext/setup.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import platform
55
import shlex
6+
import sys
67
import sysconfig
78
from test import support
89

‎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)