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