From 9816e2f0b7f319dac4cd171e9dca6974f60bbc08 Mon Sep 17 00:00:00 2001 From: Benjamin Sparks Date: Mon, 17 Feb 2025 00:43:55 +0100 Subject: [PATCH] python3Packages.pex: 2.29.0 -> 2.33.1 --- .../python-modules/pex/default.nix | 80 ++++++++++++++++--- 1 file changed, 71 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/pex/default.nix b/pkgs/development/python-modules/pex/default.nix index b7de16f6b259a5..ee7542755059a9 100644 --- a/pkgs/development/python-modules/pex/default.nix +++ b/pkgs/development/python-modules/pex/default.nix @@ -2,26 +2,88 @@ lib, buildPythonPackage, fetchPypi, - hatchling, - pythonOlder, + fetchurl, + setuptools, + + gitMinimal, + ansicolors, + pexpect, + pytest, + pytest-xdist, + coloredlogs, + psutil, }: +let + # 4 binaries which require vendoring, as otherwise + # the build system behind pex will attempt to fetch + # them during at build time + uv-trampoline = { + # Taken from https://github.com/pex-tool/pex/blob/2c66932d6645e8e542e5386eae08b9cc2dbb2a21/pex/windows/__init__.py#L45 + version = "0.5.29"; + + aarch64-gui = fetchurl { + url = "https://raw.githubusercontent.com/astral-sh/uv/refs/tags/${uv-trampoline.version}/crates/uv-trampoline/trampolines/uv-trampoline-aarch64-gui.exe"; + hash = "sha256-mb8x1FpyH+wy11X5YgWfqh/VUwBb62M4Zf9aFr5V4EE="; + }; + + aarch64-console = fetchurl { + url = "https://raw.githubusercontent.com/astral-sh/uv/refs/tags/${uv-trampoline.version}/crates/uv-trampoline/trampolines/uv-trampoline-aarch64-console.exe"; + hash = "sha256-1S2aM+6CV7rKz+3ncM5X7kk7uDQeuha1+8lUEMYC75k="; + }; + x86_64-gui = fetchurl { + url = "https://raw.githubusercontent.com/astral-sh/uv/refs/tags/${uv-trampoline.version}/crates/uv-trampoline/trampolines/uv-trampoline-x86_64-gui.exe"; + hash = "sha256-icnp1oXrOZpc+dHTGvDbTHjr+D8M0eamvRrC9bPI/KI="; + }; + + x86_64-console = fetchurl { + url = "https://raw.githubusercontent.com/astral-sh/uv/refs/tags/${uv-trampoline.version}/crates/uv-trampoline/trampolines/uv-trampoline-x86_64-console.exe"; + hash = "sha256-nLopBrlCMMFjkKVRlY7Ke2zFGpQOyF5mSlLs0d7+HRQ="; + }; + }; +in buildPythonPackage rec { pname = "pex"; - version = "2.29.0"; + version = "2.33.1"; pyproject = true; - disabled = pythonOlder "3.7"; - src = fetchPypi { inherit pname version; - hash = "sha256-2JeQ1zGKZorVqx+2OzjdF7nln00t42yxP2O0e6AVGx4="; + hash = "sha256-kHTvgXe51TencKDkFQAAdyPXuJLBNpJ0NIy1KB8p5JQ="; }; - build-system = [ hatchling ]; + preBuild = '' + mkdir -p pex/windows/stubs + cp ${uv-trampoline.aarch64-gui} pex/windows/stubs/uv-trampoline-aarch64-gui.exe + cp ${uv-trampoline.aarch64-console} pex/windows/stubs/uv-trampoline-aarch64-console.exe + cp ${uv-trampoline.x86_64-gui} pex/windows/stubs/uv-trampoline-x86_64-gui.exe + cp ${uv-trampoline.x86_64-console} pex/windows/stubs/uv-trampoline-x86_64-console.exe + ''; + + patches = [ ./changes.patch ]; + + build-system = [ setuptools ]; + + nativeCheckInputs = [ gitMinimal pexpect pytest pytest-xdist ansicolors coloredlogs psutil ]; + + checkPhase = '' + runHook preCheck + # --ignore=tests/integration/test_issue_2073.py # attempts to create venv + + # A number of tests require a writeable HOME + HOME=$(mktemp -d) PEX_ROOT=$(mktemp -d) python3 testing/bin/run_tests.py --it --color --shard 1/2 \ + --ignore=tests/integration/resolve/test_issue_1918.py \ + --ignore=tests/integration/test_sh_boot.py \ + --ignore=tests/integration/venv_ITs/test_virtualenv.py::test_iter_distributions + + runHook postCheck + ''; - # A few more dependencies I don't want to handle right now... - doCheck = false; + #P EX_ROOT=$TMPDIR python3 testing/bin/run_tests.py -x --it --color --shard 1/2 \ + # # requires SSH access to github + # --ignore=tests/integration/resolve/test_issue_1918.py \ + # # attempts to clone pyenv from git + # --ignore=tests/integration/test_sh_boot.py pythonImportsCheck = [ "pex" ];