summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/docutils/default.nix
blob: 2c9f3da24333c8e16a0ce2736c9e60916af0ef03 (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
{
  lib,
  fetchurl,
  buildPythonPackage,
  flit-core,
  pillow,
  python,
  pythonOlder,
}:

# Note: this package is used to build LLVM’s documentation, which is part of the Darwin stdenv.
# It cannot use `fetchgit` because that would pull curl into the bootstrap, which is disallowed.

let
  self = buildPythonPackage rec {
    pname = "docutils";
    version = "0.21.2";
    pyproject = true;

    src = fetchurl {
      url = "mirror://sourceforge/docutils/docutils-${version}.tar.gz";
      hash = "sha256-OmsYcy7fGC2qPNEndbuzOM9WkUaPke7rEJ3v9uv6mG8=";
    };

    build-system = [ flit-core ];

    # infinite recursion via sphinx and pillow
    doCheck = false;
    passthru.tests.pytest = self.overridePythonAttrs { doCheck = true; };

    nativeCheckInputs = [ pillow ];

    checkPhase = ''
      runHook preCheck
      ${python.interpreter} test/alltests.py
      runHook postCheck
    '';

    # Create symlinks lacking a ".py" suffix, many programs depend on these names
    postFixup = ''
      for f in $out/bin/*.py; do
        ln -s $(basename $f) $out/bin/$(basename $f .py)
      done
    '';

    pythonImportsCheck = [ "docutils" ];

    meta = {
      description = "Python Documentation Utilities";
      homepage = "http://docutils.sourceforge.net/";
      changelog = "https://sourceforge.net/projects/docutils/files/docutils/${version}";
      license = with lib.licenses; [
        publicDomain
        bsd2
        psfl
        gpl3Plus
      ];
      maintainers = with lib.maintainers; [ jherland ];
      mainProgram = "docutils";
    };
  };
in
self