nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, buildPythonPackage
4, pythonOlder
5, fetchFromGitHub
6# propagatedBuildInputs
7, babel
8, alabaster
9, docutils
10, imagesize
11, importlib-metadata
12, jinja2
13, packaging
14, pygments
15, requests
16, snowballstemmer
17, sphinxcontrib-apidoc
18, sphinxcontrib-applehelp
19, sphinxcontrib-devhelp
20, sphinxcontrib-htmlhelp
21, sphinxcontrib-jsmath
22, sphinxcontrib-qthelp
23, sphinxcontrib-serializinghtml
24, sphinxcontrib-websupport
25# check phase
26, html5lib
27, pytestCheckHook
28, typed-ast
29}:
30
31buildPythonPackage rec {
32 pname = "sphinx";
33 version = "4.5.0";
34 format = "setuptools";
35
36 disabled = pythonOlder "3.6";
37
38 src = fetchFromGitHub {
39 owner = "sphinx-doc";
40 repo = pname;
41 rev = "v${version}";
42 sha256 = "sha256-Lw9yZWCQpt02SL/McWPcyFRfVhQHC0TejcYRbVw+VxY=";
43 postFetch = ''
44 cd $out
45 mv tests/roots/test-images/testimäge.png \
46 tests/roots/test-images/testimæge.png
47 patch -p1 < ${./0001-test-images-Use-normalization-equivalent-character.patch}
48 '';
49 };
50
51 postPatch = ''
52 substituteInPlace setup.py \
53 --replace "docutils>=0.14,<0.18" "docutils>=0.14"
54
55 # remove impurity caused by date inclusion
56 # https://github.com/sphinx-doc/sphinx/blob/master/setup.cfg#L4-L6
57 substituteInPlace setup.cfg \
58 --replace "tag_build = .dev" "" \
59 --replace "tag_date = true" ""
60 '';
61
62 propagatedBuildInputs = [
63 babel
64 alabaster
65 docutils
66 imagesize
67 jinja2
68 packaging
69 pygments
70 requests
71 snowballstemmer
72 sphinxcontrib-applehelp
73 sphinxcontrib-devhelp
74 sphinxcontrib-htmlhelp
75 sphinxcontrib-jsmath
76 sphinxcontrib-qthelp
77 sphinxcontrib-serializinghtml
78 # extra[docs]
79 sphinxcontrib-websupport
80
81 # extra plugins which are otherwise not found by sphinx-build
82 sphinxcontrib-apidoc
83 ] ++ lib.optionals (pythonOlder "3.10") [
84 importlib-metadata
85 ];
86
87 checkInputs = [
88 html5lib
89 pytestCheckHook
90 ] ++ lib.optionals (pythonOlder "3.8") [
91 typed-ast
92 ];
93
94 disabledTests = [
95 # requires network access
96 "test_anchors_ignored"
97 "test_defaults"
98 "test_defaults_json"
99 "test_latex_images"
100
101 # requires imagemagick (increases build closure size), doesn't
102 # test anything substantial
103 "test_ext_imgconverter"
104 ] ++ lib.optional stdenv.isDarwin [
105 # Due to lack of network sandboxing can't guarantee port 7777 isn't bound
106 "test_inspect_main_url"
107 "test_auth_header_uses_first_match"
108 "test_linkcheck_allowed_redirects"
109 "test_linkcheck_request_headers"
110 "test_linkcheck_request_headers_no_slash"
111 "test_follows_redirects_on_HEAD"
112 "test_get_after_head_raises_connection_error"
113 "test_invalid_ssl"
114 "test_connect_to_selfsigned_with_tls_verify_false"
115 "test_connect_to_selfsigned_with_tls_cacerts"
116 "test_connect_to_selfsigned_with_requests_env_var"
117 "test_connect_to_selfsigned_nonexistent_cert_file"
118 "test_TooManyRedirects_on_HEAD"
119 "test_too_many_requests_retry_after_int_del"
120 "test_too_many_requests_retry_after_HTTP_date"
121 "test_too_many_requests_retry_after_without_header"
122 "test_too_many_requests_user_timeout"
123 "test_raises_for_invalid_status"
124 "test_auth_header_no_match"
125 "test_follows_redirects_on_GET"
126 "test_connect_to_selfsigned_fails"
127 ];
128
129 meta = with lib; {
130 description = "Python documentation generator";
131 longDescription = ''
132 A tool that makes it easy to create intelligent and beautiful
133 documentation for Python projects
134 '';
135 homepage = "https://www.sphinx-doc.org";
136 license = licenses.bsd3;
137 maintainers = teams.sphinx.members;
138 };
139}