1{ lib
2, ansible
3, ansible-core
4, anyconfig
5, appdirs
6, buildPythonPackage
7, colorama
8, fetchFromGitHub
9, flake8
10, jsonschema
11, nested-lookup
12, pathspec
13, poetry-core
14, pytest-mock
15, python-json-logger
16, pytestCheckHook
17, pythonOlder
18, pyyaml
19, toolz
20, unidiff
21, yamllint
22}:
23
24buildPythonPackage rec {
25 pname = "ansible-later";
26 version = "2.0.23";
27 format = "pyproject";
28
29 disabled = pythonOlder "3.8";
30
31 src = fetchFromGitHub {
32 owner = "thegeeklab";
33 repo = pname;
34 rev = "refs/tags/v${version}";
35 hash = "sha256-FQnyWC7d9h8Ya2BlaTGTrNXkHtJJLdeNL7qXP7scLFA=";
36 };
37
38 postPatch = ''
39 substituteInPlace pyproject.toml \
40 --replace 'version = "0.0.0"' 'version = "${version}"' \
41 --replace " --cov=ansiblelater --cov-report=xml:coverage.xml --cov-report=term --cov-append --no-cov-on-fail" "" \
42 --replace 'PyYAML = "6.0"' 'PyYAML = "*"' \
43 --replace 'unidiff = "0.7.3"' 'unidiff = "*"' \
44 --replace 'jsonschema = "' 'jsonschema = "^' \
45 --replace 'python-json-logger = "' 'python-json-logger = "^' \
46 --replace 'toolz = "0.11.2' 'toolz = "*' \
47 --replace 'yamllint = "' 'yamllint = "^'
48 '';
49
50 nativeBuildInputs = [
51 poetry-core
52 ];
53
54 propagatedBuildInputs = [
55 ansible
56 ansible-core
57 anyconfig
58 appdirs
59 colorama
60 flake8
61 jsonschema
62 nested-lookup
63 pathspec
64 python-json-logger
65 pyyaml
66 toolz
67 unidiff
68 yamllint
69 ];
70
71 checkInputs = [
72 pytest-mock
73 pytestCheckHook
74 ];
75
76 postInstall = ''
77 rm $out/lib/python*/site-packages/LICENSE
78 '';
79
80 pythonImportsCheck = [
81 "ansiblelater"
82 ];
83
84 meta = with lib; {
85 description = "Best practice scanner for Ansible roles and playbooks";
86 homepage = "https://github.com/thegeeklab/ansible-later";
87 license = licenses.mit;
88 maintainers = with maintainers; [ tboerger ];
89 };
90}