mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-02 06:00:24 +08:00
Pass Requirement objects around (#12709)
This allows us to keep metadata like python_version and platform_system and use it to conditionally install packages.
This commit is contained in:
+4
-2
@@ -139,13 +139,15 @@ def setup_testcase_dir(package: DistributionTests, tempdir: Path, verbosity: Ver
|
||||
# mypy refuses to consider a directory a "valid typeshed directory"
|
||||
# unless there's a stubs/mypy-extensions path inside it,
|
||||
# so add that to the list of stubs to copy over to the new directory
|
||||
for requirement in {package.name, *requirements.typeshed_pkgs, "mypy-extensions"}:
|
||||
typeshed_requirements = [r.name for r in requirements.typeshed_pkgs]
|
||||
for requirement in {package.name, *typeshed_requirements, "mypy-extensions"}:
|
||||
shutil.copytree(Path("stubs", requirement), new_typeshed / "stubs" / requirement)
|
||||
|
||||
if requirements.external_pkgs:
|
||||
venv_location = str(tempdir / VENV_DIR)
|
||||
subprocess.run(["uv", "venv", venv_location], check=True, capture_output=True)
|
||||
uv_command = ["uv", "pip", "install", get_mypy_req(), *requirements.external_pkgs]
|
||||
ext_requirements = [str(r) for r in requirements.external_pkgs]
|
||||
uv_command = ["uv", "pip", "install", get_mypy_req(), *ext_requirements]
|
||||
if sys.platform == "win32":
|
||||
# Reads/writes to the cache are threadsafe with uv generally...
|
||||
# but not on old Windows versions
|
||||
|
||||
Reference in New Issue
Block a user