gh-132415: Update vendored setuptools in `Lib/test/wheeldata` (#132887)

This commit is contained in:
Adam Turner 2025-04-25 00:46:20 +01:00 committed by GitHub
parent 08e3389e8c
commit c9f3f5b4ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 10 additions and 10 deletions

View file

@ -2416,7 +2416,7 @@ def _findwheel(pkgname):
filenames = os.listdir(wheel_dir)
filenames = sorted(filenames, reverse=True) # approximate "newest" first
for filename in filenames:
# filename is like 'setuptools-67.6.1-py3-none-any.whl'
# filename is like 'setuptools-{version}-py3-none-any.whl'
if not filename.endswith(".whl"):
continue
prefix = pkgname + '-'
@ -2425,16 +2425,16 @@ def _findwheel(pkgname):
raise FileNotFoundError(f"No wheel for {pkgname} found in {wheel_dir}")
# Context manager that creates a virtual environment, install setuptools and wheel in it
# and returns the path to the venv directory and the path to the python executable
# Context manager that creates a virtual environment, install setuptools in it,
# and returns the paths to the venv directory and the python executable
@contextlib.contextmanager
def setup_venv_with_pip_setuptools_wheel(venv_dir):
import shlex
def setup_venv_with_pip_setuptools(venv_dir):
import subprocess
from .os_helper import temp_cwd
def run_command(cmd):
if verbose:
import shlex
print()
print('Run:', ' '.join(map(shlex.quote, cmd)))
subprocess.run(cmd, check=True)
@ -2458,10 +2458,10 @@ def setup_venv_with_pip_setuptools_wheel(venv_dir):
else:
python = os.path.join(venv, 'bin', python_exe)
cmd = [python, '-X', 'dev',
cmd = (python, '-X', 'dev',
'-m', 'pip', 'install',
_findwheel('setuptools'),
_findwheel('wheel')]
)
run_command(cmd)
yield python

View file

@ -53,7 +53,7 @@ class TestExt(unittest.TestCase):
def check_build(self, extension_name, std=None, limited=False):
venv_dir = 'env'
with support.setup_venv_with_pip_setuptools_wheel(venv_dir) as python_exe:
with support.setup_venv_with_pip_setuptools(venv_dir) as python_exe:
self._check_build(extension_name, python_exe,
std=std, limited=limited)

View file

@ -54,7 +54,7 @@ class TestCPPExt(unittest.TestCase):
def check_build(self, extension_name, std=None, limited=False):
venv_dir = 'env'
with support.setup_venv_with_pip_setuptools_wheel(venv_dir) as python_exe:
with support.setup_venv_with_pip_setuptools(venv_dir) as python_exe:
self._check_build(extension_name, python_exe,
std=std, limited=limited)

View file

@ -99,7 +99,7 @@ class TestCParser(unittest.TestCase):
cls.addClassCleanup(shutil.rmtree, cls.library_dir)
with contextlib.ExitStack() as stack:
python_exe = stack.enter_context(support.setup_venv_with_pip_setuptools_wheel("venv"))
python_exe = stack.enter_context(support.setup_venv_with_pip_setuptools("venv"))
sitepackages = subprocess.check_output(
[python_exe, "-c", "import sysconfig; print(sysconfig.get_path('platlib'))"],
text=True,

Binary file not shown.