summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/mike/default.nix
blob: eb48339a27f0c7772e6a104725b968de6d51c5c7 (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
71
72
73
74
75
76
77
78
79
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  importlib-metadata,
  importlib-resources,
  jinja2,
  mkdocs,
  pyparsing,
  pyyaml,
  pyyaml-env-tag,
  verspec,
  versionCheckHook,
  pytestCheckHook,
  git,
  shtab,
  stdenv,
}:

buildPythonPackage rec {
  pname = "mike";
  version = "2.1.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jimporter";
    repo = "mike";
    tag = "v${version}";
    hash = "sha256-eGUkYcPTrXwsZPqyDgHJlEFXzhMnenoZsjeHVGO/9WU=";
  };

  build-system = [
    setuptools
  ];

  dependencies = [
    importlib-metadata
    importlib-resources
    jinja2
    mkdocs
    pyparsing
    pyyaml
    pyyaml-env-tag
    verspec
  ];

  nativeInstallCheckInputs = [ versionCheckHook ];
  doInstallCheck = true;

  __darwinAllowLocalNetworking = true;

  nativeCheckInputs = [
    pytestCheckHook
    git
    mkdocs
    shtab
  ];

  preCheck = ''
    export PATH=$out/bin:$PATH
  ''
  # "stat" on darwin results in "not permitted" instead of "does not exists"
  + lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace test/unit/test_git_utils.py \
      --replace-fail "/home/nonexist" "$(mktemp -d)"
  '';

  pythonImportsCheck = [ "mike" ];

  meta = {
    description = "Manage multiple versions of your MkDocs-powered documentation via Git";
    homepage = "https://github.com/jimporter/mike";
    changelog = "https://github.com/jimporter/mike/blob/v${version}/CHANGES.md";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ marcel ];
    mainProgram = "mike";
  };
}