Unverified Commit 3b636d18 authored by Anthony Roussel's avatar Anthony Roussel
Browse files

autosuspend: generate doc and man

parent 6bf4d736
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -3,6 +3,9 @@
  dbus,
  fetchFromGitHub,
  python3,
  sphinxHook,
  withDocs ? true,
  withMan ? true,
}:

python3.pkgs.buildPythonApplication (finalAttrs: {
@@ -10,6 +13,12 @@ python3.pkgs.buildPythonApplication (finalAttrs: {
  version = "10.0.0";
  pyproject = true;

  outputs = [
    "out"
  ]
  ++ lib.optionals withDocs [ "doc" ]
  ++ lib.optionals withMan [ "man" ];

  src = fetchFromGitHub {
    owner = "languitar";
    repo = "autosuspend";
@@ -17,6 +26,21 @@ python3.pkgs.buildPythonApplication (finalAttrs: {
    hash = "sha256-o9Jpb4i2/SJ3s3h5sclNjpaN/UFk1YbpPf7b3rGXLRg=";
  };

  postPatch = ''
    # This mapping triggers network access on docs generation
    substituteInPlace doc/source/conf.py \
      --replace-fail 'intersphinx_mapping' '# intersphinx_mapping'
  '';

  nativeBuildInputs = lib.optionals (withDocs || withMan) (
    [
      sphinxHook
    ]
    ++ finalAttrs.passthru.optional-dependencies.docs
  );

  sphinxBuilders = lib.optionals withDocs [ "html" ] ++ lib.optionals withMan [ "man" ];

  build-system = with python3.pkgs; [
    setuptools
  ];
@@ -36,6 +60,16 @@ python3.pkgs.buildPythonApplication (finalAttrs: {
    tzlocal
  ];

  optional-dependencies = {
    docs = with python3.pkgs; [
      furo
      recommonmark
      sphinx-autodoc-typehints
      sphinx-issues
      sphinxcontrib-plantuml
    ];
  };

  nativeCheckInputs = with python3.pkgs; [
    dbus
    freezegun