1{
2 lib,
3 buildPythonPackage,
4 docutils,
5 ephem,
6 fetchFromGitHub,
7 fetchpatch,
8 fetchpatch2,
9 funcparserlib,
10 pillow,
11 pytestCheckHook,
12 pythonOlder,
13 reportlab,
14 setuptools,
15 webcolors,
16}:
17
18buildPythonPackage rec {
19 pname = "blockdiag";
20 version = "3.0.0";
21 pyproject = true;
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "blockdiag";
27 repo = "blockdiag";
28 rev = "refs/tags/${version}";
29 hash = "sha256-j8FoNUIJJOaahaol1MRPyY2jcPCEIlaAD4bmM2QKFFI=";
30 };
31
32 patches = [
33 # https://github.com/blockdiag/blockdiag/pull/179
34 (fetchpatch {
35 name = "pillow-10-compatibility.patch";
36 url = "https://github.com/blockdiag/blockdiag/commit/20d780cad84e7b010066cb55f848477957870165.patch";
37 hash = "sha256-t1zWFzAsLL2EUa0nD4Eui4Y5AhAZLRmp/yC9QpzzeUA=";
38 })
39 # https://github.com/blockdiag/blockdiag/pull/175
40 (fetchpatch2 {
41 name = "migrate-to-pytest.patch";
42 url = "https://github.com/blockdiag/blockdiag/commit/4f4f726252084f17ecc6c524592222af09d37da4.patch";
43 hash = "sha256-OkfKJwJtb2DJRXE/8thYnisTFwcfstUFTTJHdM/qBzg=";
44 })
45 ];
46
47 postPatch = ''
48 # requires network access the url-based icon
49 # and path-based icon is set to debian logo (/usr/share/pixmaps/debian-logo.png)
50 rm src/blockdiag/tests/diagrams/node_icon.diag
51 # note: this is a postPatch as `seqdiag` uses them directly
52 '';
53
54 build-system = [ setuptools ];
55
56 dependencies = [
57 docutils
58 funcparserlib
59 pillow
60 reportlab
61 webcolors
62 ];
63
64 nativeCheckInputs = [
65 ephem
66 pytestCheckHook
67 ];
68
69 pytestFlagsArray = [ "src/blockdiag/tests/" ];
70
71 disabledTests = [
72 # Test require network access
73 "test_app_cleans_up_images"
74 ];
75
76 pythonImportsCheck = [ "blockdiag" ];
77
78 meta = with lib; {
79 description = "Generate block-diagram image from spec-text file (similar to Graphviz)";
80 homepage = "http://blockdiag.com/";
81 changelog = "https://github.com/blockdiag/blockdiag/blob/${version}/CHANGES.rst";
82 license = licenses.asl20;
83 maintainers = with maintainers; [ bjornfor ];
84 mainProgram = "blockdiag";
85 platforms = platforms.unix;
86 };
87}