1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pytestCheckHook,
6 sphinx,
7}:
8
9buildPythonPackage rec {
10 pname = "sphinx-argparse";
11 version = "0.4.0";
12 format = "setuptools";
13
14 src = fetchPypi {
15 pname = "sphinx_argparse";
16 inherit version;
17 hash = "sha256-4PNBhOtW8S+s53T7yHuICr25AXoJmNHsVZsmfpaX5Ek=";
18 };
19
20 postPatch = ''
21 # Fix tests for python-3.10 and add 3.10 to CI matrix
22 # Should be fixed in versions > 0.3.1
23 # https://github.com/ashb/sphinx-argparse/pull/3
24 substituteInPlace sphinxarg/parser.py \
25 --replace "if action_group.title == 'optional arguments':" "if action_group.title == 'optional arguments' or action_group.title == 'options':"
26 '';
27
28 propagatedBuildInputs = [ sphinx ];
29
30 nativeCheckInputs = [ pytestCheckHook ];
31
32 pythonImportsCheck = [ "sphinxarg" ];
33
34 meta = {
35 description = "Sphinx extension that automatically documents argparse commands and options";
36 homepage = "https://github.com/ashb/sphinx-argparse";
37 license = lib.licenses.mit;
38 maintainers = with lib.maintainers; [ clacke ];
39 };
40}