at 23.05-pre 106 lines 2.3 kB view raw
1{ lib 2, buildPythonPackage 3, fetchPypi 4, setuptools-scm 5, ansible-compat 6, ansible-core 7, black 8, enrich 9, filelock 10, flaky 11, jsonschema 12, pythonOlder 13, pytest 14, pytest-xdist 15, pytestCheckHook 16, pyyaml 17, rich 18, ruamel-yaml 19, wcmatch 20, yamllint 21}: 22 23buildPythonPackage rec { 24 pname = "ansible-lint"; 25 version = "6.8.6"; 26 format = "pyproject"; 27 disabled = pythonOlder "3.8"; 28 29 src = fetchPypi { 30 inherit pname version; 31 sha256 = "sha256-Fx/o2tYgeLmBm1x01g61r6ow6py5ybqHBhSeVsVam24="; 32 }; 33 34 postPatch = '' 35 # it is fine if lint tools are missing 36 substituteInPlace conftest.py \ 37 --replace "sys.exit(1)" "" 38 ''; 39 40 nativeBuildInputs = [ 41 setuptools-scm 42 ]; 43 44 propagatedBuildInputs = [ 45 ansible-compat 46 ansible-core 47 black 48 enrich 49 filelock 50 jsonschema 51 pytest # yes, this is an actual runtime dependency 52 pyyaml 53 rich 54 ruamel-yaml 55 wcmatch 56 yamllint 57 ]; 58 59 # tests can't be easily run without installing things from ansible-galaxy 60 doCheck = false; 61 62 checkInputs = [ 63 flaky 64 pytest-xdist 65 pytestCheckHook 66 ]; 67 68 preCheck = '' 69 # ansible wants to write to $HOME and crashes if it can't 70 export HOME=$(mktemp -d) 71 export PATH=$PATH:${lib.makeBinPath [ ansible-core ]} 72 73 # create a working ansible-lint executable 74 export PATH=$PATH:$PWD/src/ansiblelint 75 ln -rs src/ansiblelint/__main__.py src/ansiblelint/ansible-lint 76 patchShebangs src/ansiblelint/__main__.py 77 78 # create symlink like in the git repo so test_included_tasks does not fail 79 ln -s ../roles examples/playbooks/roles 80 ''; 81 82 disabledTests = [ 83 # requires network 84 "test_cli_auto_detect" 85 "test_install_collection" 86 "test_prerun_reqs_v1" 87 "test_prerun_reqs_v2" 88 "test_require_collection_wrong_version" 89 # re-execs ansible-lint which does not works correct 90 "test_custom_kinds" 91 "test_run_inside_role_dir" 92 "test_run_multiple_role_path_no_trailing_slash" 93 "test_runner_exclude_globs" 94 95 "test_discover_lintables_umlaut" 96 ]; 97 98 makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ansible-core ]}" ]; 99 100 meta = with lib; { 101 homepage = "https://github.com/ansible/ansible-lint"; 102 description = "Best practices checker for Ansible"; 103 license = licenses.mit; 104 maintainers = with maintainers; [ sengaya ]; 105 }; 106}