1{ lib
2, buildPythonPackage
3, isPy27
4, fetchPypi
5, setuptools-scm
6, ansible-base
7, enrich
8, flaky
9, pyyaml
10, rich
11, ruamel-yaml
12, tenacity
13, wcmatch
14, yamllint
15, pytest-xdist
16, pytestCheckHook
17}:
18
19buildPythonPackage rec {
20 pname = "ansible-lint";
21 version = "5.2.1";
22 disabled = isPy27;
23 format = "pyproject";
24
25 src = fetchPypi {
26 inherit pname version;
27 sha256 = "sha256-1krKWcjYllQdN5uSBbISa4UQiKqwosLKsZ/3SxhM3xw=";
28 };
29
30 nativeBuildInputs = [
31 setuptools-scm
32 ];
33
34 propagatedBuildInputs = [
35 ansible-base
36 enrich
37 flaky
38 pyyaml
39 rich
40 ruamel-yaml
41 tenacity
42 wcmatch
43 yamllint
44 ];
45
46 checkInputs = [
47 pytest-xdist
48 pytestCheckHook
49 ];
50
51 pytestFlagsArray = [
52 "--numprocesses" "auto"
53 ];
54
55 preCheck = ''
56 # ansible wants to write to $HOME and crashes if it can't
57 export HOME=$(mktemp -d)
58 export PATH=$PATH:${lib.makeBinPath [ ansible-base ]}
59
60 # create a working ansible-lint executable
61 export PATH=$PATH:$PWD/src/ansiblelint
62 ln -rs src/ansiblelint/__main__.py src/ansiblelint/ansible-lint
63 patchShebangs src/ansiblelint/__main__.py
64
65 # create symlink like in the git repo so test_included_tasks does not fail
66 ln -s ../roles examples/playbooks/roles
67 '';
68
69 disabledTests = [
70 # requires network
71 "test_cli_auto_detect"
72 "test_install_collection"
73 "test_prerun_reqs_v1"
74 "test_prerun_reqs_v2"
75 "test_require_collection_wrong_version"
76 # re-execs ansible-lint which does not works correct
77 "test_custom_kinds"
78 "test_run_inside_role_dir"
79 "test_run_multiple_role_path_no_trailing_slash"
80 "test_runner_exclude_globs"
81
82 "test_discover_lintables_umlaut"
83 ];
84
85 makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ansible-base ]}" ];
86
87 meta = with lib; {
88 homepage = "https://github.com/ansible-community/ansible-lint";
89 description = "Best practices checker for Ansible";
90 license = licenses.mit;
91 maintainers = with maintainers; [ sengaya SuperSandro2000 ];
92 };
93}