Remove duplicate get_external_apt_dependencies.py and re-standardize CI package install logs (#14533)

This commit is contained in:
Avasam
2025-08-20 12:48:37 -04:00
committed by GitHub
parent 2b271044dd
commit 82c02d3729
6 changed files with 26 additions and 44 deletions
+3
View File
@@ -80,16 +80,19 @@ jobs:
if [ "${{ runner.os }}" = "Linux" ]; then
if [ -n "$PACKAGES" ]; then
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
fi
PYTHON_EXECUTABLE="xvfb-run python"
else
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
brew install -q $PACKAGES
fi
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
choco install -y $PACKAGES
fi
+3 -3
View File
@@ -66,19 +66,19 @@ jobs:
if [ "${{ runner.os }}" = "Linux" ]; then
if [ -n "$PACKAGES" ]; then
echo "Installing apt packages: $PACKAGES"
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
fi
PYTHON_EXECUTABLE="xvfb-run python"
else
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
echo "Installing Homebrew packages: $PACKAGES"
printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
brew install -q $PACKAGES
fi
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
echo "Installing Chocolatey packages: $PACKAGES"
printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
choco install -y $PACKAGES
fi
+13 -15
View File
@@ -56,11 +56,10 @@ jobs:
- run: uv pip install -r requirements-tests.txt --system
- name: Install required APT packages
run: |
sudo apt-get update -qy
DEPENDENCIES=$( python tests/get_external_apt_dependencies.py )
if [ -n "$DEPENDENCIES" ]; then
printf "Installing APT packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
sudo apt-get install -qy $DEPENDENCIES
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
if [ -n "$PACKAGES" ]; then
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
fi
- name: Run mypy_test.py
run: |
@@ -108,24 +107,23 @@ jobs:
with:
version-file: "requirements-tests.txt"
- name: Install typeshed test-suite requirements
# Install these so we can run `get_external_stub_requirements.py`
# Install these so we can run `get_*_requirements.py`
run: uv pip install -r requirements-tests.txt --system
- name: Install required APT packages
run: |
sudo apt-get update -qy
DEPENDENCIES=$( python tests/get_external_apt_dependencies.py )
if [ -n "$DEPENDENCIES" ]; then
printf "Installing APT packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
sudo apt-get install -qy $DEPENDENCIES
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
if [ -n "$PACKAGES" ]; then
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
fi
- name: Create an isolated venv for testing
run: uv venv .venv
- name: Install 3rd-party stub dependencies
run: |
DEPENDENCIES=$( python tests/get_external_stub_requirements.py )
if [ -n "$DEPENDENCIES" ]; then
printf "Installing packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
uv pip install --python-version ${{ matrix.python-version }} $DEPENDENCIES
PACKAGES=$(python tests/get_external_stub_requirements.py)
if [ -n "$PACKAGES" ]; then
printf "Installing python packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
uv pip install --python-version ${{ matrix.python-version }} $PACKAGES
fi
- name: Activate the isolated venv for the rest of the job
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
+6 -5
View File
@@ -18,11 +18,12 @@ def get_external_stub_requirements(distributions: Iterable[str] = ()) -> set[Req
return set(itertools.chain.from_iterable([read_dependencies(distribution).external_pkgs for distribution in distributions]))
def get_stubtest_system_requirements(distributions: Iterable[str] = (), platform: str = sys.platform) -> list[str]:
def get_stubtest_system_requirements(distributions: Iterable[str] = (), platform: str = sys.platform) -> set[str]:
if not distributions:
distributions = os.listdir(STUBS_PATH)
requirements: list[str] = []
for distribution in distributions:
requirements.extend(read_stubtest_settings(distribution).system_requirements_for_platform(platform))
return requirements
return set(
itertools.chain.from_iterable(
[read_stubtest_settings(distribution).system_requirements_for_platform(platform) for distribution in distributions]
)
)
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env python3
import itertools
import os
import sys
from ts_utils.metadata import read_metadata
from ts_utils.paths import STUBS_PATH
if __name__ == "__main__":
distributions = sys.argv[1:]
if not distributions:
distributions = os.listdir(STUBS_PATH)
dependencies = set(
itertools.chain.from_iterable(
read_metadata(distribution).stubtest_settings.apt_dependencies for distribution in distributions
)
)
for dependency in sorted(dependencies):
print(dependency)
+1 -1
View File
@@ -5,5 +5,5 @@ from ts_utils.requirements import get_stubtest_system_requirements
if __name__ == "__main__":
distributions = sys.argv[1:]
for requirement in get_stubtest_system_requirements(distributions):
for requirement in sorted(get_stubtest_system_requirements(distributions)):
print(requirement)