summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/xml2rfc/default.nix
blob: 865c8c4d6ec1c687553f51d0e84a0551eaaa931c (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
90
{
  lib,
  buildPythonPackage,
  configargparse,
  decorator,
  dict2xml,
  fetchFromGitHub,
  google-i18n-address,
  intervaltree,
  jinja2,
  lxml,
  platformdirs,
  pycairo,
  pycountry,
  pypdf,
  pytestCheckHook,
  python-fontconfig,
  pyyaml,
  requests,
  setuptools,
  wcwidth,
}:

buildPythonPackage rec {
  pname = "xml2rfc";
  version = "3.31.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ietf-tools";
    repo = "xml2rfc";
    tag = "v${version}";
    hash = "sha256-thgLt1PHXbKxDDhqQcHUP/AZsGq/OfAOSRV9KrFmPWw=";
  };

  postPatch = ''
    substituteInPlace Makefile \
      --replace-fail "SHELL := /bin/bash" "SHELL := bash" \
      --replace-fail "test flaketest" "test"
  '';

  build-system = [ setuptools ];

  pythonRelaxDeps = [ "lxml" ];

  dependencies = [
    configargparse
    dict2xml
    google-i18n-address
    intervaltree
    jinja2
    lxml
    platformdirs
    pycountry
    pypdf
    pyyaml
    requests
    wcwidth
  ];

  nativeCheckInputs = [
    decorator
    pycairo
    pytestCheckHook
    python-fontconfig
  ];

  # Requires Noto Serif and Roboto Mono font
  doCheck = false;

  checkPhase = ''
    make tests-no-network
  '';

  pythonImportsCheck = [ "xml2rfc" ];

  meta = {
    description = "Tool generating IETF RFCs and drafts from XML sources";
    mainProgram = "xml2rfc";
    homepage = "https://github.com/ietf-tools/xml2rfc";
    changelog = "https://github.com/ietf-tools/xml2rfc/blob/${src.tag}/CHANGELOG.md";
    # Well, parts might be considered unfree, if being strict; see:
    # http://metadata.ftp-master.debian.org/changelogs/non-free/x/xml2rfc/xml2rfc_2.9.6-1_copyright
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [
      vcunat
      yrashk
    ];
  };
}