2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2021-05-20 23:08:51 +00:00
|
|
|
, fetchPypi
|
|
|
|
, setuptools-scm
|
2022-03-30 09:31:56 +00:00
|
|
|
, ansible-compat
|
|
|
|
, ansible-core
|
2021-05-20 23:08:51 +00:00
|
|
|
, enrich
|
|
|
|
, flaky
|
2022-06-16 17:23:12 +00:00
|
|
|
, jsonschema
|
|
|
|
, pythonOlder
|
|
|
|
, pytest
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, pyyaml
|
2020-10-19 23:25:03 +00:00
|
|
|
, rich
|
2021-05-20 23:08:51 +00:00
|
|
|
, ruamel-yaml
|
2021-04-05 15:23:46 +00:00
|
|
|
, wcmatch
|
2021-05-20 23:08:51 +00:00
|
|
|
, yamllint
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "ansible-lint";
|
2022-08-21 13:32:41 +00:00
|
|
|
version = "6.4.0";
|
2021-04-05 15:23:46 +00:00
|
|
|
format = "pyproject";
|
2022-03-30 09:31:56 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-08-21 13:32:41 +00:00
|
|
|
sha256 = "sha256-xadjBsrpBqJgz3KGyofE0DukSSsu17/qIa0R/fPH6NE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
postPatch = ''
|
|
|
|
# it is fine if lint tools are missing
|
|
|
|
substituteInPlace conftest.py \
|
|
|
|
--replace "sys.exit(1)" ""
|
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools-scm
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
propagatedBuildInputs = [
|
2022-03-30 09:31:56 +00:00
|
|
|
ansible-compat
|
|
|
|
ansible-core
|
2021-05-20 23:08:51 +00:00
|
|
|
enrich
|
2022-06-16 17:23:12 +00:00
|
|
|
jsonschema
|
|
|
|
pytest # yes, this is an actual runtime dependency
|
2021-05-20 23:08:51 +00:00
|
|
|
pyyaml
|
|
|
|
rich
|
|
|
|
ruamel-yaml
|
|
|
|
wcmatch
|
|
|
|
yamllint
|
|
|
|
];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
# tests can't be easily run without installing things from ansible-galaxy
|
|
|
|
doCheck = false;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
checkInputs = [
|
2022-03-30 09:31:56 +00:00
|
|
|
flaky
|
2021-05-20 23:08:51 +00:00
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# ansible wants to write to $HOME and crashes if it can't
|
2020-04-24 23:36:52 +00:00
|
|
|
export HOME=$(mktemp -d)
|
2022-03-30 09:31:56 +00:00
|
|
|
export PATH=$PATH:${lib.makeBinPath [ ansible-core ]}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
# create a working ansible-lint executable
|
|
|
|
export PATH=$PATH:$PWD/src/ansiblelint
|
|
|
|
ln -rs src/ansiblelint/__main__.py src/ansiblelint/ansible-lint
|
|
|
|
patchShebangs src/ansiblelint/__main__.py
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
# create symlink like in the git repo so test_included_tasks does not fail
|
|
|
|
ln -s ../roles examples/playbooks/roles
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
disabledTests = [
|
|
|
|
# requires network
|
2021-10-06 13:57:05 +00:00
|
|
|
"test_cli_auto_detect"
|
|
|
|
"test_install_collection"
|
2021-04-05 15:23:46 +00:00
|
|
|
"test_prerun_reqs_v1"
|
|
|
|
"test_prerun_reqs_v2"
|
2021-10-06 13:57:05 +00:00
|
|
|
"test_require_collection_wrong_version"
|
|
|
|
# re-execs ansible-lint which does not works correct
|
|
|
|
"test_custom_kinds"
|
|
|
|
"test_run_inside_role_dir"
|
|
|
|
"test_run_multiple_role_path_no_trailing_slash"
|
|
|
|
"test_runner_exclude_globs"
|
|
|
|
|
|
|
|
"test_discover_lintables_umlaut"
|
2021-04-05 15:23:46 +00:00
|
|
|
];
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ansible-core ]}" ];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "https://github.com/ansible/ansible-lint";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Best practices checker for Ansible";
|
|
|
|
license = licenses.mit;
|
2021-04-05 15:23:46 +00:00
|
|
|
maintainers = with maintainers; [ sengaya SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|