Skip to content

Commit ebd73d8

Browse files
authored
Allow explicitly requesting an system interpreter version in check_system_python (#7306)
Needed for #7300
1 parent bb0fb8e commit ebd73d8

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ jobs:
13261326
run: echo $(which python)
13271327

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

13311331
system-test-choco:
13321332
timeout-minutes: 10

scripts/check_system_python.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,18 @@ def install_package(*, uv: str, package: str):
4747
action="store_true",
4848
help="Set if the Python installation has an EXTERNALLY-MANAGED marker.",
4949
)
50+
parser.add_argument(
51+
"--python",
52+
required=False,
53+
help="Set if the system Python version must be explicitly specified, e.g., for prereleases.",
54+
)
5055
args = parser.parse_args()
5156

5257
uv: str = os.path.abspath(args.uv) if args.uv else "uv"
5358
allow_externally_managed = (
5459
["--break-system-packages"] if args.externally_managed else []
5560
)
61+
python = ["--python", args.python] if args.python else []
5662

5763
# Create a temporary directory.
5864
with tempfile.TemporaryDirectory() as temp_dir:
@@ -69,7 +75,8 @@ def install_package(*, uv: str, package: str):
6975
logging.info("Installing the package `pylint`.")
7076
subprocess.run(
7177
[uv, "pip", "install", "pylint", "--system", "--verbose"]
72-
+ allow_externally_managed,
78+
+ allow_externally_managed
79+
+ python,
7380
cwd=temp_dir,
7481
check=True,
7582
)
@@ -94,7 +101,9 @@ def install_package(*, uv: str, package: str):
94101
# Uninstall the package (`pylint`).
95102
logging.info("Uninstalling the package `pylint`.")
96103
subprocess.run(
97-
[uv, "pip", "uninstall", "pylint", "--system"] + allow_externally_managed,
104+
[uv, "pip", "uninstall", "pylint", "--system"]
105+
+ allow_externally_managed
106+
+ python,
98107
cwd=temp_dir,
99108
check=True,
100109
)

0 commit comments

Comments
 (0)