Merge pull request #326081 from doronbehar/pkg/freud
python312Packages.freud: fix build
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, buildPythonPackage
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, cython
|
||||
, oldest-supported-numpy
|
||||
, scikit-build
|
||||
, setuptools
|
||||
, tbb
|
||||
, numpy
|
||||
, rowan
|
||||
, scipy
|
||||
, pytest
|
||||
, gsd
|
||||
, matplotlib
|
||||
, sympy
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
cmake,
|
||||
cython,
|
||||
oldest-supported-numpy,
|
||||
scikit-build,
|
||||
setuptools,
|
||||
tbb,
|
||||
numpy,
|
||||
rowan,
|
||||
scipy,
|
||||
pytestCheckHook,
|
||||
python,
|
||||
gsd,
|
||||
matplotlib,
|
||||
sympy,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
@@ -29,6 +32,15 @@ buildPythonPackage rec {
|
||||
hash = "sha256-jlscEHQ1q4oqxE06NhVWCOlPRcjDcJVrvy4h6iYrkz0=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
patches = [
|
||||
# https://github.com/glotzerlab/freud/issues/1269
|
||||
(fetchpatch {
|
||||
url = "https://github.com/glotzerlab/freud/commit/8f636e3815737945e45da5b9996b5f69df07c9a5.patch";
|
||||
hash = "sha256-PLorRrYj16oBWHYzXDq62kECzVTtyr+1Z20DJqTkXxg=";
|
||||
})
|
||||
];
|
||||
|
||||
# Because we prefer to not `leaveDotGit`, we need to fool upstream into
|
||||
# thinking we left the .git files in the submodules, so cmake won't think we
|
||||
# didn't initialize them. Upstream doesn't support using the system wide
|
||||
@@ -39,6 +51,13 @@ buildPythonPackage rec {
|
||||
touch extern/{voro++,fsph,Eigen}/.git
|
||||
'';
|
||||
|
||||
# Scipy still depends on numpy 1, and so we'd get 'package duplicates in
|
||||
# closure' error if we'd use numpy_2
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace-fail 'numpy>=2.0.0rc1' 'numpy' \
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
cython
|
||||
@@ -47,9 +66,7 @@ buildPythonPackage rec {
|
||||
setuptools
|
||||
];
|
||||
dontUseCmakeConfigure = true;
|
||||
buildInputs = [
|
||||
tbb
|
||||
];
|
||||
buildInputs = [ tbb ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
numpy
|
||||
@@ -58,33 +75,29 @@ buildPythonPackage rec {
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
# Encountering circular ImportError issues with pytestCheckHook, see also:
|
||||
# https://github.com/NixOS/nixpkgs/issues/255262
|
||||
pytest
|
||||
pytestCheckHook
|
||||
gsd
|
||||
matplotlib
|
||||
sympy
|
||||
];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
pytest
|
||||
|
||||
runHook postCheck
|
||||
disabledTests = lib.optionals stdenv.isAarch64 [
|
||||
# https://github.com/glotzerlab/freud/issues/961
|
||||
"test_docstring"
|
||||
];
|
||||
# On top of cd $out due to https://github.com/NixOS/nixpkgs/issues/255262 ,
|
||||
# we need to also copy the tests because otherwise pytest won't find them.
|
||||
preCheck = ''
|
||||
cp -R tests $out/${python.sitePackages}/freud/tests
|
||||
cd $out
|
||||
'';
|
||||
# Some tests fail on aarch64. If we could have used pytestCheckHook, we would
|
||||
# have disabled only the tests that fail with the disabledTests attribute.
|
||||
# But that is not possible unfortunately. See upstream report for the
|
||||
# failure: https://github.com/glotzerlab/freud/issues/961
|
||||
doCheck = !stdenv.isAarch64;
|
||||
|
||||
pythonImportsCheck = [ "freud" ];
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
description = "Powerful, efficient particle trajectory analysis in scientific Python";
|
||||
homepage = "https://github.com/glotzerlab/freud";
|
||||
changelog = "https://github.com/glotzerlab/freud/blob/${src.rev}/ChangeLog.md";
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ doronbehar ];
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ doronbehar ];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user