summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/beancount/default.nix
blob: cc2b0bafc2dccb8c3148052fa3bae0991a24d403 (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
  lib,
  stdenv,
  bison,
  buildPythonPackage,
  click,
  fetchFromGitHub,
  fetchpatch2,
  flex,
  gnupg,
  meson,
  meson-python,
  pytestCheckHook,
  python-dateutil,
  regex,
}:

buildPythonPackage rec {
  version = "3.2.0";
  pname = "beancount";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "beancount";
    repo = "beancount";
    tag = version;
    hash = "sha256-XWTgaBvB4/SONL44afvprZwJUVrkoda5XLGNxad0kec=";
  };

  patches = [
    (fetchpatch2 {
      name = "accept-date-range-error-message-from-py3.14";
      url = "https://salsa.debian.org/python-team/packages/beancount/-/raw/debian/sid/debian/patches/0003-Accept-date-range-error-message-from-py3.14.patch";
      hash = "sha256-wqMTGSi4Gn5VADjV4MjZhFNWB3ThUhxvLYK7sentScQ=";
    })
    (fetchpatch2 {
      name = "skip-ref-count-test-with-py3.14";
      url = "https://salsa.debian.org/python-team/packages/beancount/-/raw/debian/sid/debian/patches/0004-Skip-refcount-test-with-py3.14.patch";
      hash = "sha256-6P9xe15WBGaWpVYB2HfGfFHLMMmGkfnDwdjdktlSNxk=";
    })
  ];

  build-system = [
    meson
    meson-python
  ];

  dependencies = [
    click
    python-dateutil
    regex
  ];

  nativeBuildInputs = [
    bison
    flex
  ];

  nativeCheckInputs = [
    gnupg
    pytestCheckHook
  ];

  preCheck = ''
    # avoid local paths, relative imports wont resolve correctly
    mv beancount tests
  '';

  disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
    # Cannot run the gpg-agent. If needed, implement as passthru tests.
    "test_read_encrypted_file"
    "test_include_encrypted"
  ];

  pythonImportsCheck = [ "beancount" ];

  meta = {
    homepage = "https://github.com/beancount/beancount";
    changelog = "https://github.com/beancount/beancount/releases/tag/${src.tag}";
    description = "Double-entry bookkeeping computer language";
    longDescription = ''
      A double-entry bookkeeping computer language that lets you define
      financial transaction records in a text file, read them in memory,
      generate a variety of reports from them, and provides a web interface.
    '';
    license = lib.licenses.gpl2Only;
    maintainers = with lib.maintainers; [ alapshin ];
  };
}