depot/third_party/nixpkgs/pkgs/development/python-modules/ansible-lint/default.nix
Default email ce641f4048 Project import generated by Copybara.
GitOrigin-RevId: bc5d68306b40b8522ffb69ba6cff91898c2fbbff
2021-12-06 17:07:01 +01:00

93 lines
2 KiB
Nix

{ lib
, buildPythonPackage
, isPy27
, fetchPypi
, setuptools-scm
, ansible-base
, enrich
, flaky
, pyyaml
, rich
, ruamel-yaml
, tenacity
, wcmatch
, yamllint
, pytest-xdist
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "ansible-lint";
version = "5.3.0";
disabled = isPy27;
format = "pyproject";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-LlaJQ6uZ9kdN8mK8NYCNiwVXVKprMgRknVeIRzO6zi4=";
};
nativeBuildInputs = [
setuptools-scm
];
propagatedBuildInputs = [
ansible-base
enrich
flaky
pyyaml
rich
ruamel-yaml
tenacity
wcmatch
yamllint
];
checkInputs = [
pytest-xdist
pytestCheckHook
];
pytestFlagsArray = [
"--numprocesses" "auto"
];
preCheck = ''
# ansible wants to write to $HOME and crashes if it can't
export HOME=$(mktemp -d)
export PATH=$PATH:${lib.makeBinPath [ ansible-base ]}
# 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
# create symlink like in the git repo so test_included_tasks does not fail
ln -s ../roles examples/playbooks/roles
'';
disabledTests = [
# requires network
"test_cli_auto_detect"
"test_install_collection"
"test_prerun_reqs_v1"
"test_prerun_reqs_v2"
"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"
];
makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ansible-base ]}" ];
meta = with lib; {
homepage = "https://github.com/ansible-community/ansible-lint";
description = "Best practices checker for Ansible";
license = licenses.mit;
maintainers = with maintainers; [ sengaya SuperSandro2000 ];
};
}