Files
nixpkgs/pkgs/development/python-modules/deepwave/default.nix
Winter a19cd4ffb1 Revert "treewide: replace rev with tag"
This reverts commit 65a333600d.

This wasn't tested for correctness with something like fodwatch [0],
and should not have been (self-)merged so quickly, especially without
further review.

It also resulted in the breakage of at least one package [1] (and that's
the one we know of and was caught).

A few packages that were updated in between this commit and this revert
were not reverted back to using `rev`, but other than that, this is a
1:1 revert.

[0]: https://codeberg.org/raphaelr/fodwatch
[1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e458
2025-04-08 02:57:25 -04:00

74 lines
1.6 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
torch,
ninja,
scipy,
which,
pybind11,
pytest-xdist,
pytestCheckHook,
}:
let
linePatch = ''
import os
os.environ['PATH'] = os.environ['PATH'] + ':${ninja}/bin'
'';
in
buildPythonPackage rec {
pname = "deepwave";
version = "0.0.18";
format = "pyproject";
src = fetchFromGitHub {
owner = "ar4";
repo = pname;
rev = "v${version}";
hash = "sha256-DOOy+B12jgwJzQ90qzX50OFxYLPRcVdVYSE5gi3pqDM=";
};
# unable to find ninja although it is available, most likely because it looks for its pip version
postPatch = ''
substituteInPlace setup.cfg --replace "ninja" ""
# 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
'';
# 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
# at runtime.
preBuild = ''
export HOME=$(mktemp -d)
'';
propagatedBuildInputs = [
torch
pybind11
];
nativeCheckInputs = [
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 ];
};
}