nixpkgs/pkgs/development/python-modules/daqp/default.nix
Yueh-Shun Li 91b3db1309 treewide: fix sourceRoot for fetchgit-based src
According to Nixpkgs manual[1] and NixOS 23.11 Release Note[2], the
`sourceRoot` attribute passed to `stdenv.mkDerivation` should be
specified as `"${src.name}"` or `"${src.name}/subdir"` when `src` is
produced using `fetchgit`-based fetchers.

`sourceRoot = "source"` or `sourceRoot = "source/subdir"` is based on
the assumption that the `name` attribute of these pre-unpacked fetchers
are always `"source"`, which is not the case. Expecting constant `name`
also makes the source FODs prone to irrelevent hashes during version
bumps.

[1]: https://nixos.org/manual/nixpkgs/unstable/#var-stdenv-sourceRoot
[2]: https://nixos.org/manual/nixos/stable/release-notes#sec-release-23.11
2024-03-09 07:53:25 +08:00

53 lines
1.1 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, buildPythonPackage
, unittestCheckHook
, cython
, setuptools
, wheel
, numpy
}:
buildPythonPackage rec {
pname = "daqp";
version = "0.5.1";
format = "pyproject";
src = fetchFromGitHub {
owner = "darnstrom";
repo = "daqp";
rev = "5a15a3d16731d3d50f867218c1b281567db556fd";
hash = "sha256-in7Ci/wM7i0csJ4XVfo1lboWOyfuuU+8E+TzGmMV3x0=";
};
sourceRoot = "${src.name}/interfaces/daqp-python";
postPatch = ''
sed -i 's|../../../daqp|../..|' setup.py
sed -i 's|if src_path and os.path.exists(src_path):|if False:|' setup.py
'';
nativeCheckInputs = [ unittestCheckHook ];
unittestFlagsArray = [ "-s" "test" "-p" "'*.py'" "-v" ];
nativeBuildInputs = [
cython
setuptools
wheel
];
propagatedBuildInputs = [
numpy
];
pythonImportsCheck = [ "daqp" ];
meta = with lib; {
description = "A dual active-set algorithm for convex quadratic programming";
homepage = "https://github.com/darnstrom/daqp";
license = licenses.mit;
maintainers = with maintainers; [ renesat ];
};
}