about summary refs log tree commit diff
path: root/pkgs/development/python-modules/blockdiag/default.nix
blob: 7acdf490acb401771990fec8d45a3c2dc36cfc86 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
  lib,
  buildPythonPackage,
  docutils,
  ephem,
  fetchFromGitHub,
  fetchpatch,
  fetchpatch2,
  funcparserlib,
  pillow,
  pytestCheckHook,
  pythonOlder,
  reportlab,
  setuptools,
  webcolors,
}:

buildPythonPackage rec {
  pname = "blockdiag";
  version = "3.0.0";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "blockdiag";
    repo = "blockdiag";
    rev = "refs/tags/${version}";
    hash = "sha256-j8FoNUIJJOaahaol1MRPyY2jcPCEIlaAD4bmM2QKFFI=";
  };

  patches = [
    # https://github.com/blockdiag/blockdiag/pull/179
    (fetchpatch {
      name = "pillow-10-compatibility.patch";
      url = "https://github.com/blockdiag/blockdiag/commit/20d780cad84e7b010066cb55f848477957870165.patch";
      hash = "sha256-t1zWFzAsLL2EUa0nD4Eui4Y5AhAZLRmp/yC9QpzzeUA=";
    })
    # https://github.com/blockdiag/blockdiag/pull/175
    (fetchpatch2 {
      name = "migrate-to-pytest.patch";
      url = "https://github.com/blockdiag/blockdiag/commit/4f4f726252084f17ecc6c524592222af09d37da4.patch";
      hash = "sha256-OkfKJwJtb2DJRXE/8thYnisTFwcfstUFTTJHdM/qBzg=";
    })
  ];

  postPatch = ''
    # requires network access the url-based icon
    # and path-based icon is set to debian logo (/usr/share/pixmaps/debian-logo.png)
    rm src/blockdiag/tests/diagrams/node_icon.diag
    # note: this is a postPatch as `seqdiag` uses them directly
  '';

  build-system = [ setuptools ];

  dependencies = [
    docutils
    funcparserlib
    pillow
    reportlab
    webcolors
  ];

  nativeCheckInputs = [
    ephem
    pytestCheckHook
  ];

  pytestFlagsArray = [ "src/blockdiag/tests/" ];

  disabledTests = [
    # Test require network access
    "test_app_cleans_up_images"
  ];

  pythonImportsCheck = [ "blockdiag" ];

  meta = with lib; {
    description = "Generate block-diagram image from spec-text file (similar to Graphviz)";
    homepage = "http://blockdiag.com/";
    changelog = "https://github.com/blockdiag/blockdiag/blob/${version}/CHANGES.rst";
    license = licenses.asl20;
    maintainers = with maintainers; [ bjornfor ];
    mainProgram = "blockdiag";
    platforms = platforms.unix;
  };
}