mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Add support for Homebrew and Chocolatey (#9187)
This commit is contained in:
17
.github/workflows/daily.yml
vendored
17
.github/workflows/daily.yml
vendored
@@ -69,12 +69,23 @@ jobs:
|
||||
- name: Run stubtest
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
|
||||
sudo apt update
|
||||
sudo apt install -y $(python tests/get_packages.py)
|
||||
PACKAGES=$(python tests/get_packages.py)
|
||||
|
||||
if [ "${{ runner.os }}" = "Linux" ]; then
|
||||
if [ -n "$PACKAGES" ]; then
|
||||
sudo apt update && sudo apt install -y $PACKAGES
|
||||
fi
|
||||
|
||||
xvfb-run python tests/stubtest_third_party.py --specified-stubs-only --num-shards 4 --shard-index ${{ matrix.shard-index }}
|
||||
else
|
||||
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
|
||||
NONINTERACTIVE=1 brew install $PACKAGES
|
||||
fi
|
||||
|
||||
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
|
||||
choco install -y $PACKAGES
|
||||
fi
|
||||
|
||||
python tests/stubtest_third_party.py --specified-stubs-only --num-shards 4 --shard-index ${{ matrix.shard-index }}
|
||||
fi
|
||||
|
||||
|
||||
19
.github/workflows/stubtest_third_party.yml
vendored
19
.github/workflows/stubtest_third_party.yml
vendored
@@ -58,21 +58,24 @@ jobs:
|
||||
echo "Testing $STUBS..."
|
||||
PACKAGES=$(python tests/get_packages.py $STUBS)
|
||||
|
||||
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
|
||||
if [ "${{ runner.os }}" = "Linux" ]; then
|
||||
if [ -n "$PACKAGES" ]; then
|
||||
echo "Installing apt packages: $PACKAGES"
|
||||
sudo apt update && sudo apt install -y $PACKAGES
|
||||
fi
|
||||
|
||||
xvfb-run python tests/stubtest_third_party.py --specified-stubs-only $STUBS
|
||||
fi
|
||||
else
|
||||
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
|
||||
echo "Installing Homebrew packages: $PACKAGES"
|
||||
NONINTERACTIVE=1 brew install $PACKAGES
|
||||
fi
|
||||
|
||||
if [ "${{ matrix.os }}" = "macos-latest" ]; then
|
||||
# Could install brew packages here if we run into stubs that need it
|
||||
python tests/stubtest_third_party.py --specified-stubs-only $STUBS
|
||||
fi
|
||||
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
|
||||
echo "Installing Chocolatey packages: $PACKAGES"
|
||||
choco install -y $PACKAGES
|
||||
fi
|
||||
|
||||
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
||||
# Could install choco packages here if we run into stubs that need it
|
||||
python tests/stubtest_third_party.py --specified-stubs-only $STUBS
|
||||
fi
|
||||
else
|
||||
|
||||
@@ -196,14 +196,20 @@ This has the following keys:
|
||||
package. Please avoid setting this to `true`, and add a comment if you have
|
||||
to.
|
||||
* `apt_dependencies` (default: `[]`): A list of Ubuntu APT packages
|
||||
that need to be installed for stubtest to run successfully. These are
|
||||
usually packages needed to pip install the implementation distribution.
|
||||
that need to be installed for stubtest to run successfully.
|
||||
* `brew_dependencies` (default: `[]`): A list of MacOS Homebrew packages
|
||||
that need to be installed for stubtest to run successfully
|
||||
* `choco_dependencies` (default: `[]`): A list of Windows Chocolatey packages
|
||||
that need to be installed for stubtest to run successfully
|
||||
* `platforms` (default: `["linux"]`): A list of OSes on which to run stubtest.
|
||||
Can contain `win32`, `linux`, and `darwin` values.
|
||||
If not specified, stubtest is run only on `linux`.
|
||||
Only add extra OSes to the test
|
||||
if there are platform-specific branches in a stubs package.
|
||||
|
||||
`*_dependencies` are usually packages needed to `pip install` the implementation
|
||||
distribution.
|
||||
|
||||
The format of all `METADATA.toml` files can be checked by running
|
||||
`python3 ./tests/check_consistent.py`.
|
||||
|
||||
|
||||
@@ -2,5 +2,9 @@ version = "0.5.*"
|
||||
|
||||
[tool.stubtest]
|
||||
ignore_missing_stub = false
|
||||
platforms = ["linux"]
|
||||
# darwin and win32 are equivalent
|
||||
platforms = ["linux", "darwin"]
|
||||
apt_dependencies = ["libjack-dev"]
|
||||
brew_dependencies = ["jack"]
|
||||
# No need to install on the CI. Leaving here as information for Windows contributors.
|
||||
# choco_dependencies = ["jack"]
|
||||
|
||||
@@ -2,5 +2,7 @@ version = "0.2.*"
|
||||
|
||||
[tool.stubtest]
|
||||
ignore_missing_stub = false
|
||||
platforms = ["linux"]
|
||||
# linux and win32 are equivalent
|
||||
platforms = ["linux", "darwin"]
|
||||
apt_dependencies = ["portaudio19-dev"]
|
||||
brew_dependencies = ["portaudio"]
|
||||
|
||||
@@ -2,5 +2,15 @@ version = "7.45.*"
|
||||
|
||||
[tool.stubtest]
|
||||
ignore_missing_stub = false
|
||||
# Install on Windows requires building PycURL from source
|
||||
#
|
||||
# Install on MacOS is too complicated for the CI and does not work with stubtest:
|
||||
# % brew install openssl
|
||||
# % export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
|
||||
# % export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
|
||||
# % pip install --compile --install-option="--with-openssl" pycurl
|
||||
# TODO: Test on Windows and/or MacOS once wheels are available.
|
||||
platforms = ["linux"]
|
||||
apt_dependencies = ["libcurl4-openssl-dev"]
|
||||
# No need to install on the CI. Leaving here as information for MacOS contributors.
|
||||
# brew_dependencies = ["openssl"]
|
||||
|
||||
@@ -27,7 +27,17 @@ metadata_keys = {
|
||||
"upload",
|
||||
"tool",
|
||||
}
|
||||
tool_keys = {"stubtest": {"skip", "apt_dependencies", "extras", "ignore_missing_stub", "platforms"}}
|
||||
tool_keys = {
|
||||
"stubtest": {
|
||||
"skip",
|
||||
"apt_dependencies",
|
||||
"brew_dependencies",
|
||||
"choco_dependencies",
|
||||
"extras",
|
||||
"ignore_missing_stub",
|
||||
"platforms",
|
||||
}
|
||||
}
|
||||
extension_descriptions = {".pyi": "stub", ".py": ".py"}
|
||||
supported_stubtest_platforms = {"win32", "darwin", "linux"}
|
||||
|
||||
|
||||
@@ -9,12 +9,7 @@ distributions = sys.argv[1:]
|
||||
if not distributions:
|
||||
distributions = os.listdir("stubs")
|
||||
|
||||
metadata_mapping = {
|
||||
"linux": "apt_dependencies",
|
||||
# We could add others here if we run into stubs that need it:
|
||||
# "darwin": "brew_dependencies",
|
||||
# "win32": "choco_dependencies",
|
||||
}
|
||||
metadata_mapping = {"linux": "apt_dependencies", "darwin": "brew_dependencies", "win32": "choco_dependencies"}
|
||||
|
||||
if platform in metadata_mapping:
|
||||
for distribution in distributions:
|
||||
|
||||
Reference in New Issue
Block a user