nixpkgs/pkgs/development/python-modules/deal-solver/default.nix
Theodore Ni cb56c35264
z3, python310Packages.deal-solver: pass python dependencies
Z3 Python bindings import pkg_resources, which comes from setuptools.
deal-solver used to pick this up from astroid, but the latest version of
astroid removed this. Instead, let's pass this dependency explicitly
from the Z3 derivation.
2022-11-20 16:23:40 -08:00

59 lines
1.2 KiB
Nix

{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, flit-core
, z3
, astroid
, pytestCheckHook
, hypothesis
}:
buildPythonPackage rec {
pname = "deal-solver";
version = "0.1.1";
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "life4";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-LXBAWbm8fT/jYNbzB95YeBL9fEknMNJvkTRMbc+nf6c=";
};
nativeBuildInputs = [
flit-core
];
postPatch = ''
# Use upstream z3 implementation
substituteInPlace pyproject.toml \
--replace "\"z3-solver\"," "" \
--replace "\"--cov=deal_solver\"," "" \
--replace "\"--cov-report=html\"," "" \
--replace "\"--cov-report=xml\"," "" \
--replace "\"--cov-report=term-missing:skip-covered\"," "" \
--replace "\"--cov-fail-under=100\"," ""
'';
propagatedBuildInputs = [
z3
astroid
] ++ z3.requiredPythonModules;
checkInputs = [
pytestCheckHook
hypothesis
];
pythonImportsCheck = [ "deal_solver" ];
meta = with lib; {
description = "Z3-powered solver (theorem prover) for deal";
homepage = "https://github.com/life4/deal-solver";
license = licenses.mit;
maintainers = with maintainers; [ gador ];
};
}