Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 21.05 95 lines 2.2 kB view raw
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.0.8"; 22 disabled = isPy27; 23 format = "pyproject"; 24 25 src = fetchPypi { 26 inherit pname version; 27 sha256 = "sha256-tnuWKEB66bwVuwu3H3mHG99ZP+/msGhMDMRL5fyQgD8="; 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 postPatch = '' 56 # Both patches are addressed in https://github.com/ansible-community/ansible-lint/pull/1549 57 # and should be removed once merged upstream 58 59 # fixes test_get_yaml_files_umlaut and test_run_inside_role_dir 60 substituteInPlace src/ansiblelint/file_utils.py \ 61 --replace 'os.path.join(root, name)' 'os.path.normpath(os.path.join(root, name))' 62 # fixes test_custom_kinds 63 substituteInPlace src/ansiblelint/file_utils.py \ 64 --replace "if name.endswith('.yaml') or name.endswith('.yml')" "" 65 ''; 66 67 preCheck = '' 68 # ansible wants to write to $HOME and crashes if it can't 69 export HOME=$(mktemp -d) 70 export PATH=$PATH:${lib.makeBinPath [ ansible-base ]} 71 72 # create a working ansible-lint executable 73 export PATH=$PATH:$PWD/src/ansiblelint 74 ln -rs src/ansiblelint/__main__.py src/ansiblelint/ansible-lint 75 patchShebangs src/ansiblelint/__main__.py 76 77 # create symlink like in the git repo so test_included_tasks does not fail 78 ln -s ../roles examples/playbooks/roles 79 ''; 80 81 disabledTests = [ 82 # requires network 83 "test_prerun_reqs_v1" 84 "test_prerun_reqs_v2" 85 ]; 86 87 makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ansible-base ]}" ]; 88 89 meta = with lib; { 90 homepage = "https://github.com/ansible-community/ansible-lint"; 91 description = "Best practices checker for Ansible"; 92 license = licenses.mit; 93 maintainers = with maintainers; [ sengaya SuperSandro2000 ]; 94 }; 95}