Extend system-install.yml to include virtualenv operations (#2190)
Just basic stuff like: we can create a virtualenv, we can install into it (and not affect the system Python).
This commit is contained in:
@@ -42,9 +42,6 @@ jobs:
|
||||
- name: "Validate global Python install"
|
||||
run: python scripts/check_system_python.py --uv ./target/debug/uv
|
||||
|
||||
- name: "Create virtual environment"
|
||||
run: ./target/debug/uv venv
|
||||
|
||||
install-pypy:
|
||||
name: "Install PyPy on Ubuntu"
|
||||
runs-on: ubuntu-latest
|
||||
@@ -69,9 +66,6 @@ jobs:
|
||||
- name: "Validate global Python install"
|
||||
run: pypy scripts/check_system_python.py --uv ./target/debug/uv
|
||||
|
||||
- name: "Create virtual environment"
|
||||
run: ./target/debug/uv venv
|
||||
|
||||
install-macos:
|
||||
name: "Install Python on macOS"
|
||||
runs-on: macos-14
|
||||
@@ -95,9 +89,6 @@ jobs:
|
||||
- name: "Validate global Python install"
|
||||
run: python3.11 scripts/check_system_python.py --uv ./target/debug/uv
|
||||
|
||||
- name: "Create virtual environment"
|
||||
run: ./target/debug/uv venv
|
||||
|
||||
install-windows-python-310:
|
||||
name: "Install Python 3.10 on Windows"
|
||||
runs-on: windows-latest
|
||||
@@ -122,9 +113,6 @@ jobs:
|
||||
- name: "Validate global Python install"
|
||||
run: py -3.10 ./scripts/check_system_python.py --uv ./target/debug/uv
|
||||
|
||||
- name: "Create virtual environment"
|
||||
run: ./target/debug/uv venv
|
||||
|
||||
install-windows-python-313:
|
||||
name: "Install Python 3.13 on Windows"
|
||||
runs-on: windows-latest
|
||||
@@ -151,9 +139,6 @@ jobs:
|
||||
- name: "Validate global Python install"
|
||||
run: py -3.13 ./scripts/check_system_python.py --uv ./target/debug/uv
|
||||
|
||||
- name: "Create virtual environment"
|
||||
run: ./target/debug/uv venv
|
||||
|
||||
install-choco:
|
||||
name: "Install Python 3.12 via Chocolatey"
|
||||
runs-on: windows-latest
|
||||
@@ -177,9 +162,6 @@ jobs:
|
||||
- name: "Validate global Python install"
|
||||
run: py -3.9 ./scripts/check_system_python.py --uv ./target/debug/uv
|
||||
|
||||
- name: "Create virtual environment"
|
||||
run: ./target/debug/uv venv
|
||||
|
||||
install-pyenv:
|
||||
name: "Install Python via pyenv"
|
||||
runs-on: ubuntu-latest
|
||||
@@ -204,6 +186,3 @@ jobs:
|
||||
|
||||
- name: "Validate global Python install"
|
||||
run: python3.9 scripts/check_system_python.py --uv ./target/debug/uv
|
||||
|
||||
- name: "Create virtual environment"
|
||||
run: ./target/debug/uv venv
|
||||
|
||||
@@ -12,8 +12,6 @@ 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()
|
||||
@@ -29,24 +27,24 @@ if __name__ == "__main__":
|
||||
cwd=temp_dir,
|
||||
)
|
||||
if code.returncode == 0:
|
||||
raise Exception("The package `pylint` is installed.")
|
||||
raise Exception("The package `pylint` is installed (but shouldn't be).")
|
||||
|
||||
# Install the package (`pylint`).
|
||||
logging.info("Installing the package `pylint`.")
|
||||
subprocess.run(
|
||||
[uv, "pip", "install", "pylint", "--system", "--verbose"],
|
||||
[uv, "pip", "install", "pylint", "--system"],
|
||||
cwd=temp_dir,
|
||||
check=True,
|
||||
)
|
||||
|
||||
# Ensure that the package (`pylint`) isn't installed.
|
||||
# Ensure that the package (`pylint`) is installed.
|
||||
logging.info("Checking that `pylint` is installed.")
|
||||
code = subprocess.run(
|
||||
[sys.executable, "-m", "pip", "show", "pylint"],
|
||||
cwd=temp_dir,
|
||||
)
|
||||
if code.returncode != 0:
|
||||
raise Exception("The package `pylint` isn't installed.")
|
||||
raise Exception("The package `pylint` isn't installed (but should be).")
|
||||
|
||||
# TODO(charlie): Windows is failing to find the `pylint` binary, despite
|
||||
# confirmation that it's being written to the intended location.
|
||||
@@ -59,7 +57,7 @@ if __name__ == "__main__":
|
||||
# Uninstall the package (`pylint`).
|
||||
logging.info("Uninstalling the package `pylint`.")
|
||||
subprocess.run(
|
||||
[uv, "pip", "uninstall", "pylint", "--system", "--verbose"],
|
||||
[uv, "pip", "uninstall", "pylint", "--system"],
|
||||
cwd=temp_dir,
|
||||
check=True,
|
||||
)
|
||||
@@ -71,4 +69,53 @@ if __name__ == "__main__":
|
||||
cwd=temp_dir,
|
||||
)
|
||||
if code.returncode == 0:
|
||||
raise Exception("The package `pylint` is installed.")
|
||||
raise Exception("The package `pylint` is installed (but shouldn't be).")
|
||||
|
||||
# Create a virtual environment with `uv`.
|
||||
logging.info("Creating virtual environment...")
|
||||
subprocess.run(
|
||||
[uv, "venv", ".venv", "--seed", "--python", sys.executable],
|
||||
cwd=temp_dir,
|
||||
check=True,
|
||||
)
|
||||
|
||||
if os.name == "nt":
|
||||
executable = os.path.join(temp_dir, ".venv", "Scripts", "python.exe")
|
||||
else:
|
||||
executable = os.path.join(temp_dir, ".venv", "bin", "python")
|
||||
|
||||
logging.info("Querying virtual environment...")
|
||||
subprocess.run(
|
||||
[executable, "--version"],
|
||||
cwd=temp_dir,
|
||||
check=True,
|
||||
)
|
||||
|
||||
logging.info("Installing into virtual environment...")
|
||||
subprocess.run(
|
||||
[uv, "pip", "install", "pylint"],
|
||||
cwd=temp_dir,
|
||||
check=True,
|
||||
)
|
||||
|
||||
# Ensure that the package (`pylint`) isn't installed globally.
|
||||
logging.info("Checking that `pylint` isn't installed.")
|
||||
code = subprocess.run(
|
||||
[sys.executable, "-m", "pip", "show", "pylint"],
|
||||
cwd=temp_dir,
|
||||
)
|
||||
if code.returncode == 0:
|
||||
raise Exception(
|
||||
"The package `pylint` is installed globally (but shouldn't be)."
|
||||
)
|
||||
|
||||
# Ensure that the package (`pylint`) is installed in the virtual environment.
|
||||
logging.info("Checking that `pylint` is installed.")
|
||||
code = subprocess.run(
|
||||
[executable, "-m", "pip", "show", "pylint"],
|
||||
cwd=temp_dir,
|
||||
)
|
||||
if code.returncode != 0:
|
||||
raise Exception(
|
||||
"The package `pylint` isn't installed in the virtual environment."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user