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