summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/sphinx-version-warning/default.nix
blob: faa4c72d6287537de3b4fa70f26892c4f16c1ce0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  setuptools,
  sphinx,
  sphinx-autoapi,
  sphinx-prompt,
  sphinx-rtd-theme,
  sphinx-tabs,
  sphinxemoji,
  sphinxHook,
}:

# Latest tagged release release "1.1.2" (Nov 2018) does not contain
# documentation, it was added in commits Aug 10, 2019. Repository does not have
# any activity since then.
buildPythonPackage {
  pname = "sphinx-version-warning";
  version = "unstable-2019-08-10";
  pyproject = true;

  outputs = [
    "out"
    "doc"
  ];

  postPatch = ''
    substituteInPlace docs/conf.py --replace-fail "sphinx-prompt" "sphinx_prompt"
  '';

  src = fetchFromGitHub {
    owner = "humitos";
    repo = "sphinx-version-warning";
    rev = "a82156c2ea08e5feab406514d0ccd9d48a345f48";
    hash = "sha256-WnJYMk1gPLT0dBn7lmxVDNVkLYkDCgQOtM9fQ3kc6k0=";
  };

  # It tries to write to file relative to it own location at runtime
  # and gets permission denied, since Nix store is immutable.
  patches = [
    (fetchpatch {
      url = "https://github.com/humitos/sphinx-version-warning/commit/cb1b47becf2a0d3b2570ca9929f42f7d7e472b6f.patch";
      hash = "sha256-Vj0QAHIBmc0VxE+TTmJePzvr5nc45Sn2qqM+C/pkgtM=";
    })
  ];

  nativeBuildInputs = [
    sphinx-autoapi
    sphinx-prompt
    sphinx-rtd-theme
    sphinx-tabs
    sphinxemoji
    sphinxHook
    setuptools
  ];

  buildInputs = [ sphinx ];

  pythonImportsCheck = [ "versionwarning" ];

  meta = {
    description = "Sphinx extension to show a warning banner at the top of your documentation";
    homepage = "https://github.com/humitos/sphinx-version-warning";
    changelog = "https://github.com/humitos/sphinx-version-warning/blob/master/CHANGELOG.rst";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ kaction ];
  };
}