diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6ab5a259..95999acf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -291,6 +291,31 @@ jobs: - name: "Validate global Python install" run: pyston scripts/check_system_python.py --uv ./uv + system-test-alpine: + needs: build-binary-linux + name: "check system | alpine" + runs-on: ubuntu-latest + container: alpine:latest + steps: + - uses: actions/checkout@v4 + + - name: "Install Python" + run: apk add --update --no-cache python3 py3-pip + + - name: "Download binary" + uses: actions/download-artifact@v4 + with: + name: uv-linux-${{ github.sha }} + + - name: "Prepare binary" + run: chmod +x ./uv + + - name: "Print Python path" + run: echo $(which python3) + + - name: "Validate global Python install" + run: python3 scripts/check_system_python.py --uv ./uv --externally-managed + system-test-macos: needs: build-binary-macos-aarch64 name: "check system | python on macos" @@ -383,7 +408,7 @@ jobs: run: py -3.9 ./scripts/check_system_python.py --uv ./uv.exe system-test-pyenv: - needs: build-binary-windows + needs: build-binary-linux name: "check system | python via pyenv" runs-on: ubuntu-latest steps: diff --git a/scripts/check_system_python.py b/scripts/check_system_python.py index a4ba8bf6b..a29c00ba3 100755 --- a/scripts/check_system_python.py +++ b/scripts/check_system_python.py @@ -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, )