Add system install test for alpine (#2371)

This commit is contained in:
Zanie Blue 2024-03-12 09:26:05 -05:00 committed by GitHub
parent 28bf493709
commit 659f412964
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 3 deletions

View file

@ -14,9 +14,17 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Check a Python interpreter.")
parser.add_argument("--uv", help="Path to a uv binary.")
parser.add_argument(
"--externally-managed",
action="store_true",
help="Set if the Python installation has an EXTERNALLY-MANAGED marker.",
)
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 []
)
# Create a temporary directory.
with tempfile.TemporaryDirectory() as temp_dir:
@ -32,7 +40,7 @@ if __name__ == "__main__":
# Install the package (`pylint`).
logging.info("Installing the package `pylint`.")
subprocess.run(
[uv, "pip", "install", "pylint", "--system"],
[uv, "pip", "install", "pylint", "--system"] + allow_externally_managed,
cwd=temp_dir,
check=True,
)
@ -57,7 +65,7 @@ if __name__ == "__main__":
# Uninstall the package (`pylint`).
logging.info("Uninstalling the package `pylint`.")
subprocess.run(
[uv, "pip", "uninstall", "pylint", "--system"],
[uv, "pip", "uninstall", "pylint", "--system"] + allow_externally_managed,
cwd=temp_dir,
check=True,
)