mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Allow explicitly requesting an system interpreter version in check_system_python
(#7306)
Needed for #7300
This commit is contained in:
parent
bb0fb8e9bf
commit
ebd73d83f8
2 changed files with 12 additions and 3 deletions
|
@ -47,12 +47,18 @@ if __name__ == "__main__":
|
|||
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:
|
||||
|
@ -69,7 +75,8 @@ if __name__ == "__main__":
|
|||
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,
|
||||
)
|
||||
|
@ -94,7 +101,9 @@ if __name__ == "__main__":
|
|||
# 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,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue