2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
torch,
|
|
|
|
ninja,
|
|
|
|
scipy,
|
|
|
|
which,
|
|
|
|
pybind11,
|
|
|
|
pytest-xdist,
|
|
|
|
pytestCheckHook,
|
2022-07-14 12:49:19 +00:00
|
|
|
}:
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
let
|
|
|
|
linePatch = ''
|
|
|
|
import os
|
|
|
|
os.environ['PATH'] = os.environ['PATH'] + ':${ninja}/bin'
|
|
|
|
'';
|
|
|
|
in
|
2022-07-14 12:49:19 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "deepwave";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "0.0.18";
|
2022-07-14 12:49:19 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ar4";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-05-24 13:37:59 +00:00
|
|
|
hash = "sha256-DOOy+B12jgwJzQ90qzX50OFxYLPRcVdVYSE5gi3pqDM=";
|
2022-07-14 12:49:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# unable to find ninja although it is available, most likely because it looks for its pip version
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg --replace "ninja" ""
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
# Adding ninja to the path forcibly
|
|
|
|
mv src/deepwave/__init__.py tmp
|
|
|
|
echo "${linePatch}" > src/deepwave/__init__.py
|
|
|
|
cat tmp >> src/deepwave/__init__.py
|
|
|
|
rm tmp
|
2022-07-14 12:49:19 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# The source files are compiled at runtime and cached at the
|
|
|
|
# $HOME/.cache folder, so for the check phase it is needed to
|
|
|
|
# have a temporary home. This is also the reason ninja is not
|
|
|
|
# needed at the nativeBuildInputs, since it will only be used
|
2022-08-12 12:06:08 +00:00
|
|
|
# at runtime.
|
2022-07-14 12:49:19 +00:00
|
|
|
preBuild = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
torch
|
|
|
|
pybind11
|
|
|
|
];
|
2022-07-14 12:49:19 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-07-14 12:49:19 +00:00
|
|
|
which
|
|
|
|
scipy
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "deepwave" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Wave propagation modules for PyTorch";
|
|
|
|
homepage = "https://github.com/ar4/deepwave";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = intersectLists platforms.x86_64 platforms.linux;
|
|
|
|
maintainers = with maintainers; [ atila ];
|
|
|
|
};
|
|
|
|
}
|