1{ lib
2, buildPythonPackage
3, cython
4, fetchFromGitHub
5, fetchurl
6, gcc
7, graphviz
8, pytestCheckHook
9, pythonOlder
10, sphinx
11}:
12
13buildPythonPackage rec {
14 pname = "sphinx-automodapi";
15 version = "0.14.1";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "astropy";
22 repo = pname;
23 rev = "v${version}";
24 hash = "sha256-olD9LIyFCNEu287wQIRqoabfrdcdyZpNc69jq/e1304=";
25 };
26
27 propagatedBuildInputs = [ sphinx ];
28
29 # https://github.com/astropy/sphinx-automodapi/issues/155
30 testInventory = fetchurl {
31 # Originally: https://docs.python.org/3/objects.inv
32 url = "https://web.archive.org/web/20221007193144/https://docs.python.org/3/objects.inv";
33 hash = "sha256-1cbUmdJJSoifkiIYa70SxnLsaK3F2gvnTEWo9vo/6rY=";
34 };
35
36 postPatch = ''
37 substituteInPlace "sphinx_automodapi/tests/helpers.py" \
38 --replace '[0]), None)' "[0]), (None, '${testInventory}'))"
39
40 substituteInPlace "sphinx_automodapi/tests/test_cases.py" \
41 --replace '[0]), None)' "[0]), (None, '${testInventory}'))"
42 '';
43
44 nativeCheckInputs = [
45 pytestCheckHook
46 cython
47 gcc
48 graphviz
49 ];
50
51 pythonImportsCheck = [ "sphinx_automodapi" ];
52
53 meta = with lib; {
54 description = "Sphinx extension for generating API documentation";
55 homepage = "https://github.com/astropy/sphinx-automodapi";
56 license = licenses.bsd3;
57 maintainers = with maintainers; [ lovesegfault ];
58 };
59}