-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afe7fe6
commit 6b40ac0
Showing
3 changed files
with
199 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: System Install | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_RETRY: 10 | ||
CARGO_TERM_COLOR: always | ||
RUSTUP_MAX_RETRIES: 10 | ||
|
||
jobs: | ||
install-ubuntu: | ||
name: "Install Python on Ubuntu" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: "Install Rust toolchain" | ||
run: rustup show | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: "Build" | ||
run: cargo build | ||
|
||
- name: "Print Python path" | ||
run: echo $(which python) | ||
|
||
- name: "Validate global Python install" | ||
run: python scripts/check_system_python.py --uv ./target/debug/uv | ||
|
||
install-macos: | ||
name: "Install Python on macOS" | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: "Install Python" | ||
run: brew install [email protected] | ||
|
||
- name: "Install Rust toolchain" | ||
run: rustup show | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: "Build" | ||
run: cargo build | ||
|
||
- name: "Print Python path" | ||
run: echo $(which python3.11) | ||
|
||
- name: "Validate global Python install" | ||
run: python3.11 scripts/check_system_python.py --uv ./target/debug/uv | ||
|
||
install-windows: | ||
name: "Install Python on Windows" | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# - name: "Install Python" | ||
# run: choco install python | ||
|
||
- name: "Install Rust toolchain" | ||
run: rustup show | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: "Build" | ||
run: cargo build | ||
|
||
# - name: "Print Python path" | ||
# run: echo $(which python3.12) | ||
|
||
- name: "Validate global Python install" | ||
run: py ./scripts/check_system_python.py --uv ./target/debug/uv | ||
|
||
install-pyenv: | ||
name: "Install Python using pyenv" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: "Install pyenv" | ||
uses: "gabrielfalcao/pyenv-action@v18" | ||
with: | ||
default: 3.9.7 | ||
|
||
- name: "Install Rust toolchain" | ||
run: rustup show | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: "Build" | ||
run: cargo build | ||
|
||
- name: "Print Python path" | ||
run: echo $(which python3.9) | ||
|
||
- name: "Validate global Python install" | ||
run: python3.9 scripts/check_system_python.py --uv ./target/debug/uv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Install `black` into the system Python.""" | ||
|
||
import argparse | ||
import logging | ||
import os | ||
import subprocess | ||
import sys | ||
import tempfile | ||
|
||
if __name__ == "__main__": | ||
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") | ||
|
||
print("sys.executable:: %s" % sys.executable) | ||
|
||
parser = argparse.ArgumentParser(description="Check a Python interpreter.") | ||
parser.add_argument("--uv", help="Path to a uv binary.") | ||
args = parser.parse_args() | ||
|
||
uv: str = os.path.abspath(args.uv) if args.uv else "uv" | ||
|
||
# Create a temporary directory. | ||
temp_dir = tempfile.mkdtemp() | ||
|
||
# Ensure that the package (`black`) isn't installed. | ||
logging.info("Checking that `black` isn't installed.") | ||
code = subprocess.run( | ||
[sys.executable, "-m", "pip", "show", "black"], | ||
cwd=temp_dir, | ||
) | ||
if code.returncode == 0: | ||
raise Exception("The package `black` is installed.") | ||
|
||
# Install the package (`black`). | ||
logging.info("Installing the package `black`.") | ||
subprocess.run( | ||
[uv, "pip", "install", "black", "--system", "--verbose"], | ||
cwd=temp_dir, | ||
check=True, | ||
) | ||
|
||
# Ensure that the package (`black`) isn't installed. | ||
logging.info("Checking that `black` is installed.") | ||
code = subprocess.run( | ||
[sys.executable, "-m", "pip", "show", "black"], | ||
cwd=temp_dir, | ||
) | ||
if code.returncode != 0: | ||
raise Exception("The package `black` isn't installed.") | ||
|
||
# Ensure that the package is in the path. | ||
logging.info("Checking that `black` is in the path.") | ||
code = subprocess.run( | ||
["black", "--version"], | ||
cwd=temp_dir, | ||
) | ||
if code.returncode != 0: | ||
raise Exception("The package `black` isn't in the path.") | ||
|
||
# Uninstall the package (`black`). | ||
logging.info("Uninstalling the package `black`.") | ||
subprocess.run( | ||
[uv, "pip", "uninstall", "black", "--system", "--verbose"], | ||
cwd=temp_dir, | ||
check=True, | ||
) | ||
|
||
# Ensure that the package (`black`) isn't installed. | ||
logging.info("Checking that `black` isn't installed.") | ||
code = subprocess.run( | ||
[sys.executable, "-m", "pip", "show", "black"], | ||
cwd=temp_dir, | ||
) | ||
if code.returncode == 0: | ||
raise Exception("The package `black` is installed.") |