Cross-platform third-party stubs requirements install script (#13482)

This commit is contained in:
Avasam
2025-02-09 16:21:22 -05:00
committed by GitHub
parent 46ac2e24a4
commit c99e54da3e
6 changed files with 51 additions and 40 deletions

View File

@@ -27,9 +27,7 @@ You can list or install all of a stubs package's external dependencies using the
(.venv3)$ python tests/get_external_stub_requirements.py <third_party_stub> # List external dependencies for <third_party_stub>
(.venv3)$ python tests/get_external_stub_requirements.py <third_party_stub1> <third_party_stub2> # List external dependencies for <third_party_stub1> and <third_party_stub2>
(.venv3)$ python tests/get_external_stub_requirements.py # List external dependencies for all third-party stubs in typeshed
# Install external dependencies for all third-party stubs in typeshed
(.venv3)$ mapfile -t DEPENDENCIES < <( python tests/get_external_stub_requirements.py )
(.venv3)$ if [ -n "$DEPENDENCIES" ]; then pip install "${DEPENDENCIES[@]}"; fi
(.venv3)$ python scripts/install_all_third_party_dependencies.py # Install external dependencies for all third-party stubs in typeshed
```
## Run all tests for a specific stub

View File

@@ -3,23 +3,11 @@
# TODO: It should be possible to specify the Python version and platform
# and limit the output to the packages that are compatible with that version
# and platform.
from __future__ import annotations
import os
import sys
from packaging.requirements import Requirement
from ts_utils.requirements import get_external_stub_requirements
from ts_utils.metadata import read_dependencies
distributions = sys.argv[1:]
if not distributions:
distributions = os.listdir("stubs")
requirements = set[Requirement]()
for distribution in distributions:
requirements.update(read_dependencies(distribution).external_pkgs)
for requirement in sorted(requirements, key=str):
print(requirement)
if __name__ == "__main__":
distributions = sys.argv[1:]
for requirement in sorted(get_external_stub_requirements(distributions), key=str):
print(requirement)

View File

@@ -1,16 +1,9 @@
#!/usr/bin/env python3
import os
import sys
from ts_utils.metadata import read_stubtest_settings
from ts_utils.requirements import get_stubtest_system_requirements
platform = sys.platform
distributions = sys.argv[1:]
if not distributions:
distributions = os.listdir("stubs")
for distribution in distributions:
stubtest_settings = read_stubtest_settings(distribution)
for package in stubtest_settings.system_requirements_for_platform(platform):
print(package)
if __name__ == "__main__":
distributions = sys.argv[1:]
for requirement in get_stubtest_system_requirements(distributions):
print(requirement)