about summary refs log tree commit diff
path: root/pkgs/development/python-modules/deal-solver/default.nix
blob: d3101f73e54097b63a5b541b23392a2f3f18769e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, flit-core
, z3
, astroid
, pytestCheckHook
, hypothesis
}:

buildPythonPackage rec {
  pname = "deal-solver";
  version = "0.1.0";
  format = "pyproject";
  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "life4";
    repo = pname;
    rev = "refs/tags/${version}";
    hash = "sha256-eSSyLBwPc0rrfew91nLBagYDD6aJRyx0cE9YTTSODI8=";
  };

  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
  ];

  checkInputs = [
    pytestCheckHook
    hypothesis
  ];

  disabledTests = [
    # z3 assertion error
    "test_expr_asserts_ok"
  ];

  disabledTestPaths = [
    # regex matching seems flaky on tests
    "tests/test_stdlib/test_re.py"
  ];

  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 ];
  };
}