mirror of https://github.com/astral-sh/uv
Allow explicitly requesting an system interpreter version in `check_system_python` (#7306)
Needed for #7300
This commit is contained in:
parent
bb0fb8e9bf
commit
ebd73d83f8
|
|
@ -1326,7 +1326,7 @@ jobs:
|
||||||
run: echo $(which python)
|
run: echo $(which python)
|
||||||
|
|
||||||
- name: "Validate global Python install"
|
- 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:
|
system-test-choco:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,18 @@ if __name__ == "__main__":
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Set if the Python installation has an EXTERNALLY-MANAGED marker.",
|
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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
uv: str = os.path.abspath(args.uv) if args.uv else "uv"
|
uv: str = os.path.abspath(args.uv) if args.uv else "uv"
|
||||||
allow_externally_managed = (
|
allow_externally_managed = (
|
||||||
["--break-system-packages"] if args.externally_managed else []
|
["--break-system-packages"] if args.externally_managed else []
|
||||||
)
|
)
|
||||||
|
python = ["--python", args.python] if args.python else []
|
||||||
|
|
||||||
# Create a temporary directory.
|
# Create a temporary directory.
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
|
|
@ -69,7 +75,8 @@ if __name__ == "__main__":
|
||||||
logging.info("Installing the package `pylint`.")
|
logging.info("Installing the package `pylint`.")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[uv, "pip", "install", "pylint", "--system", "--verbose"]
|
[uv, "pip", "install", "pylint", "--system", "--verbose"]
|
||||||
+ allow_externally_managed,
|
+ allow_externally_managed
|
||||||
|
+ python,
|
||||||
cwd=temp_dir,
|
cwd=temp_dir,
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
|
|
@ -94,7 +101,9 @@ if __name__ == "__main__":
|
||||||
# Uninstall the package (`pylint`).
|
# Uninstall the package (`pylint`).
|
||||||
logging.info("Uninstalling the package `pylint`.")
|
logging.info("Uninstalling the package `pylint`.")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[uv, "pip", "uninstall", "pylint", "--system"] + allow_externally_managed,
|
[uv, "pip", "uninstall", "pylint", "--system"]
|
||||||
|
+ allow_externally_managed
|
||||||
|
+ python,
|
||||||
cwd=temp_dir,
|
cwd=temp_dir,
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue