From efa0f7d58cf1fe3a83d73930d1f5006fc614f6bd Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 13 Jan 2024 13:28:00 +0100 Subject: [PATCH] python311Packages.ale-py: fix build --- .../python-modules/ale-py/default.nix | 21 +++++++++++++++---- .../ale-py/patch-sha-check-in-setup.patch | 17 +++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/python-modules/ale-py/patch-sha-check-in-setup.patch diff --git a/pkgs/development/python-modules/ale-py/default.nix b/pkgs/development/python-modules/ale-py/default.nix index 77978654e68f..6390fbf6d3f1 100644 --- a/pkgs/development/python-modules/ale-py/default.nix +++ b/pkgs/development/python-modules/ale-py/default.nix @@ -2,7 +2,7 @@ , SDL2 , cmake , fetchFromGitHub -, git +, fetchpatch , gym , importlib-metadata , importlib-resources @@ -11,7 +11,6 @@ , numpy , pybind11 , pytestCheckHook -, python , pythonOlder , setuptools , stdenv @@ -23,7 +22,7 @@ buildPythonPackage rec { pname = "ale-py"; version = "0.8.1"; - format = "pyproject"; + pyproject = true; src = fetchFromGitHub { owner = "mgbellemare"; @@ -35,6 +34,20 @@ buildPythonPackage rec { patches = [ # don't download pybind11, use local pybind11 ./cmake-pybind11.patch + ./patch-sha-check-in-setup.patch + + # The following two patches add the required `include ` for compilation to work with GCC 13. + # See https://github.com/Farama-Foundation/Arcade-Learning-Environment/pull/503 + (fetchpatch { + name = "fix-gcc13-compilation-1"; + url = "https://github.com/Farama-Foundation/Arcade-Learning-Environment/commit/ebd64c03cdaa3d8df7da7c62ec3ae5795105e27a.patch"; + hash = "sha256-NMz0hw8USOj88WryHRkMQNWznnP6+5aWovEYNuocQ2c="; + }) + (fetchpatch { + name = "fix-gcc13-compilation-2"; + url = "https://github.com/Farama-Foundation/Arcade-Learning-Environment/commit/4c99c7034f17810f3ff6c27436bfc3b40d08da21.patch"; + hash = "sha256-66/bDCyMr1RsKk63T9GnFZGloLlkdr/bf5WHtWbX6VY="; + }) ]; nativeBuildInputs = [ @@ -67,7 +80,7 @@ buildPythonPackage rec { substituteInPlace pyproject.toml \ --replace 'dynamic = ["version"]' 'version = "${version}"' substituteInPlace setup.py \ - --replace 'subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=here)' 'b"${src.rev}"' + --replace '@sha@' '"${version}"' ''; dontUseCmakeConfigure = true; diff --git a/pkgs/development/python-modules/ale-py/patch-sha-check-in-setup.patch b/pkgs/development/python-modules/ale-py/patch-sha-check-in-setup.patch new file mode 100644 index 000000000000..f387346ded37 --- /dev/null +++ b/pkgs/development/python-modules/ale-py/patch-sha-check-in-setup.patch @@ -0,0 +1,17 @@ +diff --git a/setup.py b/setup.py +index ff1b1c5..ce40df0 100644 +--- a/setup.py ++++ b/setup.py +@@ -141,11 +141,7 @@ def parse_version(version_file): + + version = ci_version + else: +- sha = ( +- subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=here) +- .decode("ascii") +- .strip() +- ) ++ sha = @sha@ + version += f"+{sha}" + + return version