1{
2 stdenv,
3 lib,
4 fetchFromRepoOrCz,
5 buildPythonPackage,
6 flit-core,
7 pillow,
8 python,
9 pythonOlder,
10}:
11
12# Note: this package is used to build LLVM’s documentation, which is part of the Darwin stdenv.
13# It cannot use `fetchgit` because that would pull curl into the bootstrap, which is disallowed.
14
15let
16 self = buildPythonPackage rec {
17 pname = "docutils";
18 version = "0.21.2";
19 pyproject = true;
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromRepoOrCz {
24 repo = "docutils";
25 rev = "docutils-${version}";
26 hash = "sha256-Q+9yW+BYUEvPYV504368JsAoKKoaTZTeKh4tVeiNv5Y=";
27 };
28
29 build-system = [ flit-core ];
30
31 # infinite recursion via sphinx and pillow
32 doCheck = false;
33 passthru.tests.pytest = self.overridePythonAttrs { doCheck = true; };
34
35 nativeCheckInputs = [ pillow ];
36
37 # Only Darwin needs LANG, but we could set it in general.
38 # It's done here conditionally to prevent mass-rebuilds.
39 checkPhase =
40 lib.optionalString stdenv.isDarwin ''LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8" ''
41 + ''
42 ${python.interpreter} test/alltests.py
43 '';
44
45 # Create symlinks lacking a ".py" suffix, many programs depend on these names
46 postFixup = ''
47 for f in $out/bin/*.py; do
48 ln -s $(basename $f) $out/bin/$(basename $f .py)
49 done
50 '';
51
52 meta = with lib; {
53 description = "Python Documentation Utilities";
54 homepage = "http://docutils.sourceforge.net/";
55 license = with licenses; [
56 publicDomain
57 bsd2
58 psfl
59 gpl3Plus
60 ];
61 maintainers = with maintainers; [ AndersonTorres ];
62 };
63 };
64in
65self