about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/plantuml-markdown/default.nix
blob: 50e6bb2cf94189ecefc313ef082c778c220763a4 (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
{ buildPythonPackage
, fetchFromGitHub
, lib
, plantuml
, markdown
, requests
, six
, runCommand
, writeText
, plantuml-markdown
, pythonOlder
}:

buildPythonPackage rec {
  pname = "plantuml-markdown";
  version = "3.9.4";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "mikitex70";
    repo = pname;
    rev = "refs/tags/${version}";
    hash = "sha256-DSR4/PEs1uzGHgtw5p3HMlquOIYHPWbTHrw6QGx7t4o=";
  };

  propagatedBuildInputs = [
    plantuml
    markdown
    requests
    six
  ];

  # The package uses a custom script that downloads a certain version of plantuml for testing.
  doCheck = false;

  pythonImportsCheck = [
    "plantuml_markdown"
  ];

  passthru.tests.example-doc =
    let
      exampleDoc = writeText "plantuml-markdown-example-doc.md" ''
        ```plantuml
          Bob -> Alice: Hello
        ```
      '';
    in
    runCommand "plantuml-markdown-example-doc"
      {
        nativeBuildInputs = [ plantuml-markdown ];
      } ''
      markdown_py -x plantuml_markdown ${exampleDoc} > $out

      ! grep -q "Error" $out
    '';

  meta = with lib; {
    description = "PlantUML plugin for Python-Markdown";
    longDescription = ''
      This plugin implements a block extension which can be used to specify a PlantUML
      diagram which will be converted into an image and inserted in the document.
    '';
    homepage = "https://github.com/mikitex70/plantuml-markdown";
    changelog = "https://github.com/mikitex70/plantuml-markdown/releases/tag/${version}";
    license = licenses.bsd2;
    maintainers = with maintainers; [ nikstur ];
  };
}