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 tag = 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 setuptools
62 webcolors
63 ];
64
65 nativeCheckInputs = [
66 ephem
67 pytestCheckHook
68 ];
69
70 enabledTestPaths = [ "src/blockdiag/tests/" ];
71
72 disabledTests = [
73 # Test require network access
74 "test_app_cleans_up_images"
75 # DeprecationWarning in dependency: reportlab
76 "test_align_option_1"
77 # Comparison w/ magic values in test
78 "test_generate_with_separate"
79 ];
80
81 pythonImportsCheck = [ "blockdiag" ];
82
83 meta = with lib; {
84 description = "Generate block-diagram image from spec-text file (similar to Graphviz)";
85 homepage = "http://blockdiag.com/";
86 changelog = "https://github.com/blockdiag/blockdiag/blob/${version}/CHANGES.rst";
87 license = licenses.asl20;
88 maintainers = with maintainers; [ bjornfor ];
89 mainProgram = "blockdiag";
90 platforms = platforms.unix;
91 };
92}