Merge pull request #313188 from Moraxyc/fix-symengine

python312Packages.symengine: fix build

authored by Robert Scott and committed by GitHub a33684e3 62dbda8c

+37 -19
+37 -19
pkgs/development/python-modules/symengine/default.nix
··· 1 - { lib 2 - , buildPythonPackage 3 - , fetchFromGitHub 4 - , cython 5 - , cmake 6 - , symengine 7 - , pytest 8 - , sympy 9 - , python 1 + { 2 + lib, 3 + buildPythonPackage, 4 + fetchFromGitHub, 5 + fetchpatch, 6 + cython, 7 + cmake, 8 + symengine, 9 + pytest, 10 + sympy, 11 + python, 12 + setuptools, 10 13 }: 11 14 12 15 buildPythonPackage rec { 13 16 pname = "symengine"; 14 17 version = "0.11.0"; 15 - format = "setuptools"; 18 + 19 + build-system = [ setuptools ]; 20 + pyproject = true; 16 21 17 22 src = fetchFromGitHub { 18 23 owner = "symengine"; ··· 21 26 hash = "sha256-uUMcNnynE2itIwc7IGFwxveqLRL8f4dAAcaD6FUWJaY="; 22 27 }; 23 28 29 + env = { 30 + SymEngine_DIR = "${symengine}"; 31 + }; 32 + 33 + patches = [ 34 + # Distutils has been removed in python 3.12 35 + # See https://github.com/symengine/symengine.py/pull/478 36 + (fetchpatch { 37 + name = "no-distutils.patch"; 38 + url = "https://github.com/symengine/symengine.py/pull/478/commits/e72006d5f7425cd50c54b22766e0ed4bcd2dca85.patch"; 39 + hash = "sha256-kGJRGkBgxOfI1wf88JwnSztkOYd1wvg62H7wA6CcYEQ="; 40 + }) 41 + ]; 42 + 24 43 postPatch = '' 25 44 substituteInPlace setup.py \ 26 - --replace "\"cmake\"" "\"${cmake}/bin/cmake\"" \ 27 - --replace "'cython>=0.29.24'" "'cython'" 45 + --replace-fail "\"cmake\"" "\"${lib.getExe' cmake "cmake"}\"" \ 46 + --replace-fail "'cython>=0.29.24'" "'cython'" 47 + 48 + export PATH=${cython}/bin:$PATH 28 49 ''; 29 50 30 51 nativeBuildUnputs = [ cmake ]; 31 52 32 53 buildInputs = [ cython ]; 33 54 34 - nativeCheckInputs = [ pytest sympy ]; 35 - 36 - setupPyBuildFlags = [ 37 - "--symengine-dir=${symengine}/" 38 - "--define=\"CYTHON_BIN=${cython}/bin/cython\"" 55 + nativeCheckInputs = [ 56 + pytest 57 + sympy 39 58 ]; 40 59 41 60 checkPhase = '' 42 - mkdir empty 43 - cd empty 61 + mkdir empty && cd empty 44 62 ${python.interpreter} ../bin/test_python.py 45 63 ''; 46 64