1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, pythonOlder 5, aws-sam-translator 6, importlib-metadata 7, importlib-resources 8, jsonpatch 9, jsonschema 10, junit-xml 11, networkx 12, pathlib2 13, pyyaml 14, requests 15, setuptools 16, six 17, mock 18, pydot 19, pytestCheckHook 20}: 21 22buildPythonPackage rec { 23 pname = "cfn-lint"; 24 version = "0.54.2"; 25 26 src = fetchFromGitHub { 27 owner = "aws-cloudformation"; 28 repo = "cfn-python-lint"; 29 rev = "v${version}"; 30 sha256 = "04d5zyjnrl3b6cb2fxmbpii27mnq77wqsglfxfv2a1zj2p9xby0p"; 31 }; 32 33 postPatch = '' 34 substituteInPlace setup.py \ 35 --replace 'importlib_resources~=1.4;python_version<"3.7" and python_version!="3.4"' 'importlib_resources;python_version<"3.7"' 36 ''; 37 38 propagatedBuildInputs = [ 39 aws-sam-translator 40 jsonpatch 41 jsonschema 42 junit-xml 43 networkx 44 pathlib2 45 pyyaml 46 requests 47 setuptools 48 six 49 ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata importlib-resources ]; 50 51 checkInputs = [ 52 mock 53 pydot 54 pytestCheckHook 55 ]; 56 57 preCheck = '' 58 export PATH=$out/bin:$PATH 59 ''; 60 61 disabledTests = [ 62 # These tests depend on the current date, for example because of issues like this. 63 # This makes it possible for them to succeed on hydra and then begin to fail without 64 # any code changes. 65 # https://github.com/aws-cloudformation/cfn-python-lint/issues/1705 66 # See also: https://github.com/NixOS/nixpkgs/issues/108076 67 "TestQuickStartTemplates" 68 # requires git directory 69 "test_update_docs" 70 # Tests depend on network access (fails in getaddrinfo) 71 "test_update_resource_specs_python_2" 72 "test_update_resource_specs_python_3" 73 ]; 74 75 pythonImportsCheck = [ 76 "cfnlint" 77 "cfnlint.conditions" 78 "cfnlint.core" 79 "cfnlint.decode.node" 80 "cfnlint.decode.cfn_yaml" 81 "cfnlint.decode.cfn_json" 82 "cfnlint.decorators.refactored" 83 "cfnlint.graph" 84 "cfnlint.helpers" 85 "cfnlint.rules" 86 "cfnlint.runner" 87 "cfnlint.template" 88 "cfnlint.transform" 89 ]; 90 91 meta = with lib; { 92 description = "Checks cloudformation for practices and behaviour that could potentially be improved"; 93 homepage = "https://github.com/aws-cloudformation/cfn-python-lint"; 94 changelog = "https://github.com/aws-cloudformation/cfn-python-lint/blob/master/CHANGELOG.md"; 95 license = licenses.mit; 96 }; 97}