1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, flit-core
6, z3
7, astroid
8, pytestCheckHook
9, hypothesis
10}:
11
12buildPythonPackage rec {
13 pname = "deal-solver";
14 version = "0.1.2";
15 format = "pyproject";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "life4";
21 repo = pname;
22 rev = "refs/tags/${version}";
23 hash = "sha256-DAOeQLFR/JED32uJSW7W9+Xx5f1Et05W8Fp+Vm7sfZo=";
24 };
25
26 nativeBuildInputs = [
27 flit-core
28 ];
29
30 postPatch = ''
31 # Use upstream z3 implementation
32 substituteInPlace pyproject.toml \
33 --replace "\"z3-solver\"," "" \
34 --replace "\"--cov=deal_solver\"," "" \
35 --replace "\"--cov-report=html\"," "" \
36 --replace "\"--cov-report=xml\"," "" \
37 --replace "\"--cov-report=term-missing:skip-covered\"," "" \
38 --replace "\"--cov-fail-under=100\"," ""
39 '';
40
41 propagatedBuildInputs = [
42 z3
43 astroid
44 ] ++ z3.requiredPythonModules;
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 hypothesis
49 ];
50
51 pythonImportsCheck = [ "deal_solver" ];
52
53 meta = with lib; {
54 description = "Z3-powered solver (theorem prover) for deal";
55 homepage = "https://github.com/life4/deal-solver";
56 changelog = "https://github.com/life4/deal-solver/releases/tag/${version}";
57 license = licenses.mit;
58 maintainers = with maintainers; [ gador ];
59 };
60}