Merge pull request #326081 from doronbehar/pkg/freud

python312Packages.freud: fix build

authored by Doron Behar and committed by GitHub bfe1416e 6af55cb9

+50 -37
+50 -37
pkgs/development/python-modules/freud/default.nix
··· 1 - { lib 2 - , stdenv 3 - , buildPythonPackage 4 - , fetchFromGitHub 5 - , cmake 6 - , cython 7 - , oldest-supported-numpy 8 - , scikit-build 9 - , setuptools 10 - , tbb 11 - , numpy 12 - , rowan 13 - , scipy 14 - , pytest 15 - , gsd 16 - , matplotlib 17 - , sympy 1 + { 2 + lib, 3 + stdenv, 4 + buildPythonPackage, 5 + fetchFromGitHub, 6 + fetchpatch, 7 + cmake, 8 + cython, 9 + oldest-supported-numpy, 10 + scikit-build, 11 + setuptools, 12 + tbb, 13 + numpy, 14 + rowan, 15 + scipy, 16 + pytestCheckHook, 17 + python, 18 + gsd, 19 + matplotlib, 20 + sympy, 18 21 }: 19 22 20 23 buildPythonPackage rec { ··· 29 32 hash = "sha256-jlscEHQ1q4oqxE06NhVWCOlPRcjDcJVrvy4h6iYrkz0="; 30 33 fetchSubmodules = true; 31 34 }; 35 + 36 + patches = [ 37 + # https://github.com/glotzerlab/freud/issues/1269 38 + (fetchpatch { 39 + url = "https://github.com/glotzerlab/freud/commit/8f636e3815737945e45da5b9996b5f69df07c9a5.patch"; 40 + hash = "sha256-PLorRrYj16oBWHYzXDq62kECzVTtyr+1Z20DJqTkXxg="; 41 + }) 42 + ]; 43 + 32 44 # Because we prefer to not `leaveDotGit`, we need to fool upstream into 33 45 # thinking we left the .git files in the submodules, so cmake won't think we 34 46 # didn't initialize them. Upstream doesn't support using the system wide ··· 39 51 touch extern/{voro++,fsph,Eigen}/.git 40 52 ''; 41 53 54 + # Scipy still depends on numpy 1, and so we'd get 'package duplicates in 55 + # closure' error if we'd use numpy_2 56 + postPatch = '' 57 + substituteInPlace pyproject.toml \ 58 + --replace-fail 'numpy>=2.0.0rc1' 'numpy' \ 59 + ''; 60 + 42 61 nativeBuildInputs = [ 43 62 cmake 44 63 cython ··· 47 66 setuptools 48 67 ]; 49 68 dontUseCmakeConfigure = true; 50 - buildInputs = [ 51 - tbb 52 - ]; 69 + buildInputs = [ tbb ]; 53 70 54 71 propagatedBuildInputs = [ 55 72 numpy ··· 58 75 ]; 59 76 60 77 nativeCheckInputs = [ 61 - # Encountering circular ImportError issues with pytestCheckHook, see also: 62 - # https://github.com/NixOS/nixpkgs/issues/255262 63 - pytest 78 + pytestCheckHook 64 79 gsd 65 80 matplotlib 66 81 sympy 67 82 ]; 68 - checkPhase = '' 69 - runHook preCheck 70 - 71 - pytest 72 - 73 - runHook postCheck 83 + disabledTests = lib.optionals stdenv.isAarch64 [ 84 + # https://github.com/glotzerlab/freud/issues/961 85 + "test_docstring" 86 + ]; 87 + # On top of cd $out due to https://github.com/NixOS/nixpkgs/issues/255262 , 88 + # we need to also copy the tests because otherwise pytest won't find them. 89 + preCheck = '' 90 + cp -R tests $out/${python.sitePackages}/freud/tests 91 + cd $out 74 92 ''; 75 - # Some tests fail on aarch64. If we could have used pytestCheckHook, we would 76 - # have disabled only the tests that fail with the disabledTests attribute. 77 - # But that is not possible unfortunately. See upstream report for the 78 - # failure: https://github.com/glotzerlab/freud/issues/961 79 - doCheck = !stdenv.isAarch64; 80 93 81 94 pythonImportsCheck = [ "freud" ]; 82 95 83 - meta = with lib; { 96 + meta = { 84 97 description = "Powerful, efficient particle trajectory analysis in scientific Python"; 85 98 homepage = "https://github.com/glotzerlab/freud"; 86 99 changelog = "https://github.com/glotzerlab/freud/blob/${src.rev}/ChangeLog.md"; 87 - license = licenses.bsd3; 88 - maintainers = with maintainers; [ doronbehar ]; 100 + license = lib.licenses.bsd3; 101 + maintainers = with lib.maintainers; [ doronbehar ]; 89 102 }; 90 103 }