Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow explicitly requesting an system interpreter version in check_system_python #7306

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ jobs:
run: echo $(which python)

- name: "Validate global Python install"
run: py -3.13 ./scripts/check_system_python.py --uv ./uv.exe
run: py -3.13 ./scripts/check_system_python.py --uv ./uv.exe --python 3.13

system-test-choco:
timeout-minutes: 10
Expand Down
13 changes: 11 additions & 2 deletions scripts/check_system_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,18 @@ def install_package(*, uv: str, package: str):
action="store_true",
help="Set if the Python installation has an EXTERNALLY-MANAGED marker.",
)
parser.add_argument(
"--python",
required=False,
help="Set if the system Python version must be explicitly specified, e.g., for prereleases.",
)
args = parser.parse_args()

uv: str = os.path.abspath(args.uv) if args.uv else "uv"
allow_externally_managed = (
["--break-system-packages"] if args.externally_managed else []
)
python = ["--python", args.python] if args.python else []

# Create a temporary directory.
with tempfile.TemporaryDirectory() as temp_dir:
Expand All @@ -69,7 +75,8 @@ def install_package(*, uv: str, package: str):
logging.info("Installing the package `pylint`.")
subprocess.run(
[uv, "pip", "install", "pylint", "--system", "--verbose"]
+ allow_externally_managed,
+ allow_externally_managed
+ python,
cwd=temp_dir,
check=True,
)
Expand All @@ -94,7 +101,9 @@ def install_package(*, uv: str, package: str):
# Uninstall the package (`pylint`).
logging.info("Uninstalling the package `pylint`.")
subprocess.run(
[uv, "pip", "uninstall", "pylint", "--system"] + allow_externally_managed,
[uv, "pip", "uninstall", "pylint", "--system"]
+ allow_externally_managed
+ python,
cwd=temp_dir,
check=True,
)
Expand Down
Loading