1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 importlib-metadata,
7 importlib-resources,
8 jinja2,
9 mkdocs,
10 pyparsing,
11 pyyaml,
12 pyyaml-env-tag,
13 verspec,
14 versionCheckHook,
15 pytestCheckHook,
16 git,
17 shtab,
18 stdenv,
19}:
20
21buildPythonPackage rec {
22 pname = "mike";
23 version = "2.1.3";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "jimporter";
28 repo = "mike";
29 tag = "v${version}";
30 hash = "sha256-eGUkYcPTrXwsZPqyDgHJlEFXzhMnenoZsjeHVGO/9WU=";
31 };
32
33 build-system = [
34 setuptools
35 ];
36
37 dependencies = [
38 importlib-metadata
39 importlib-resources
40 jinja2
41 mkdocs
42 pyparsing
43 pyyaml
44 pyyaml-env-tag
45 verspec
46 ];
47
48 nativeInstallCheckInputs = [ versionCheckHook ];
49 versionCheckProgramArg = "--version";
50 doInstallCheck = true;
51
52 __darwinAllowLocalNetworking = true;
53
54 nativeCheckInputs = [
55 pytestCheckHook
56 git
57 mkdocs
58 shtab
59 ];
60
61 preCheck =
62 ''
63 export PATH=$out/bin:$PATH
64 ''
65 # "stat" on darwin results in "not permitted" instead of "does not exists"
66 + lib.optionalString stdenv.hostPlatform.isDarwin ''
67 substituteInPlace test/unit/test_git_utils.py \
68 --replace-fail "/home/nonexist" "$(mktemp -d)"
69 '';
70
71 pythonImportsCheck = [ "mike" ];
72
73 meta = {
74 description = "Manage multiple versions of your MkDocs-powered documentation via Git";
75 homepage = "https://github.com/jimporter/mike";
76 changelog = "https://github.com/jimporter/mike/blob/v${version}/CHANGES.md";
77 license = lib.licenses.bsd3;
78 maintainers = with lib.maintainers; [ marcel ];
79 mainProgram = "mike";
80 };
81}