2019-05-01 09:59:49 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2020-09-12 16:26:12 +01:00
|
|
|
, fetchFromGitHub
|
2019-12-21 09:52:28 +00:00
|
|
|
, pythonOlder
|
2019-05-01 09:59:49 +01:00
|
|
|
, aws-sam-translator
|
2019-12-21 09:52:28 +00:00
|
|
|
, importlib-metadata
|
|
|
|
, importlib-resources
|
2019-05-01 09:59:49 +01:00
|
|
|
, jsonpatch
|
|
|
|
, jsonschema
|
2020-06-11 09:49:49 +01:00
|
|
|
, junit-xml
|
|
|
|
, networkx
|
2020-09-12 16:26:12 +01:00
|
|
|
, pathlib2
|
|
|
|
, pyyaml
|
|
|
|
, requests
|
|
|
|
, setuptools
|
|
|
|
, six
|
|
|
|
, mock
|
|
|
|
, pydot
|
2020-12-02 06:16:22 +00:00
|
|
|
, pytestCheckHook
|
2019-05-01 09:59:49 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cfn-lint";
|
2020-12-02 06:16:22 +00:00
|
|
|
version = "0.42.0";
|
2019-05-01 09:59:49 +01:00
|
|
|
|
2020-09-12 16:26:12 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aws-cloudformation";
|
2020-12-02 06:16:22 +00:00
|
|
|
repo = "cfn-python-lint";
|
2020-09-12 16:26:12 +01:00
|
|
|
rev = "v${version}";
|
2020-12-02 06:16:22 +00:00
|
|
|
sha256 = "0cqpq7pxpslpd7am6mp6nmwhsb2p2a5lq3hjjxi8imv3wv7zql98";
|
2019-05-01 09:59:49 +01:00
|
|
|
};
|
|
|
|
|
2020-09-11 12:38:27 +01:00
|
|
|
postPatch = ''
|
2020-12-02 06:16:22 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace 'importlib_resources~=1.4;python_version<"3.7" and python_version!="3.4"' 'importlib_resources;python_version<"3.7"'
|
2020-09-11 12:38:27 +01:00
|
|
|
'';
|
|
|
|
|
2019-05-01 09:59:49 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
aws-sam-translator
|
|
|
|
jsonpatch
|
|
|
|
jsonschema
|
2020-06-11 09:49:49 +01:00
|
|
|
junit-xml
|
|
|
|
networkx
|
2020-09-12 16:26:12 +01:00
|
|
|
pathlib2
|
|
|
|
pyyaml
|
|
|
|
requests
|
|
|
|
setuptools
|
|
|
|
six
|
2019-12-21 09:52:28 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata importlib-resources ];
|
2019-05-01 09:59:49 +01:00
|
|
|
|
2020-12-02 06:16:22 +00:00
|
|
|
checkInputs = [
|
|
|
|
mock
|
|
|
|
pydot
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export PATH=$out/bin:$PATH
|
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTests = [
|
2021-01-01 21:19:38 +00:00
|
|
|
# These tests depend on the current date, for example because of issues like this.
|
|
|
|
# This makes it possible for them to succeed on hydra and then begin to fail without
|
|
|
|
# any code changes.
|
|
|
|
# https://github.com/aws-cloudformation/cfn-python-lint/issues/1705
|
|
|
|
# See also: https://github.com/NixOS/nixpkgs/issues/108076
|
|
|
|
"TestQuickStartTemplates"
|
2020-12-02 06:16:22 +00:00
|
|
|
# requires git directory
|
|
|
|
"test_update_docs"
|
|
|
|
];
|
|
|
|
|
2020-09-11 12:38:27 +01:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"cfnlint"
|
|
|
|
"cfnlint.conditions"
|
|
|
|
"cfnlint.core"
|
|
|
|
"cfnlint.decode.node"
|
|
|
|
"cfnlint.decode.cfn_yaml"
|
|
|
|
"cfnlint.decode.cfn_json"
|
|
|
|
"cfnlint.decorators.refactored"
|
|
|
|
"cfnlint.graph"
|
|
|
|
"cfnlint.helpers"
|
|
|
|
"cfnlint.rules"
|
|
|
|
"cfnlint.runner"
|
|
|
|
"cfnlint.template"
|
|
|
|
"cfnlint.transform"
|
|
|
|
];
|
2019-05-01 09:59:49 +01:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Checks cloudformation for practices and behaviour that could potentially be improved";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/aws-cloudformation/cfn-python-lint";
|
2020-09-12 16:26:12 +01:00
|
|
|
changelog = "https://github.com/aws-cloudformation/cfn-python-lint/blob/master/CHANGELOG.md";
|
2019-05-01 09:59:49 +01:00
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|