2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pythonOlder,
|
|
|
|
fetchPypi,
|
|
|
|
buildPythonPackage,
|
|
|
|
rustPlatform,
|
|
|
|
pytestCheckHook,
|
|
|
|
psutil,
|
|
|
|
cbor2,
|
2023-04-12 12:48:02 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pycddl";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "0.5.2";
|
2023-04-12 12:48:02 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-LdecJPSov2Y/QI4MWb20DcF0EtMuDO0VwiQDUeD55GI=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = with rustPlatform; [
|
|
|
|
maturinBuildHook
|
|
|
|
cargoSetupHook
|
|
|
|
];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# We don't place pytest-benchmark in the closure because we have no
|
|
|
|
# intention of running the benchmarks. Make sure pip doesn't fail as a
|
|
|
|
# result of it being missing by removing it from the requirements list.
|
|
|
|
sed -i -e /pytest-benchmark/d requirements-dev.txt
|
|
|
|
|
|
|
|
# Now that we've gotten rid of pytest-benchmark we need to get rid of the
|
|
|
|
# benchmarks too, otherwise they fail at import time due to the missing
|
|
|
|
# dependency.
|
|
|
|
rm tests/test_benchmarks.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-FJET2Xb1cq4aePFhPXpp2oEPIOtpugYWNFAa2Dj0F6Y=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
psutil
|
|
|
|
cbor2
|
|
|
|
];
|
2023-04-12 12:48:02 +00:00
|
|
|
pythonImportsCheck = [ "pycddl" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python bindings for the Rust cddl crate";
|
|
|
|
homepage = "https://gitlab.com/tahoe-lafs/pycddl";
|
|
|
|
changelog = "https://gitlab.com/tahoe-lafs/pycddl/-/tree/v${version}#release-notes";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.exarkun ];
|
|
|
|
};
|
|
|
|
}
|