summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ansible-lint
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2021-05-24 09:55:24 -0500
committerRobin Gloster <mail@glob.in>2021-05-24 09:55:24 -0500
commit4bc5fbef9d159e143fb7e2c3231932e6e76f667c (patch)
treee2198f5c552e0667d838b8ec764ddb3a4d8f6dec /pkgs/development/python-modules/ansible-lint
parentjq: fix build with structured-attrs on darwin (diff)
parentMerge pull request #123802 from superherointj/package-virtmanager-bugfix (diff)
downloadnixpkgs-origin/structured-attrs.tar.gz
Merge remote-tracking branch 'upstream/master' into structured-attrsorigin/structured-attrs
Diffstat (limited to 'pkgs/development/python-modules/ansible-lint')
-rw-r--r--pkgs/development/python-modules/ansible-lint/default.nix83
1 files changed, 50 insertions, 33 deletions
diff --git a/pkgs/development/python-modules/ansible-lint/default.nix b/pkgs/development/python-modules/ansible-lint/default.nix
index dfa8d5c17997..b9d4f47b4aca 100644
--- a/pkgs/development/python-modules/ansible-lint/default.nix
+++ b/pkgs/development/python-modules/ansible-lint/default.nix
@@ -1,73 +1,90 @@
{ lib
-, stdenv
-, fetchPypi
, buildPythonPackage
, isPy27
-, ansible
+, fetchPypi
+, setuptools-scm
+, ansible-base
+, enrich
+, flaky
, pyyaml
-, ruamel-yaml
, rich
-, pytestCheckHook
-, pytest-xdist
-, git
+, ruamel-yaml
+, tenacity
, wcmatch
-, enrich
-, python
+, yamllint
+, pytest-xdist
+, pytestCheckHook
}:
buildPythonPackage rec {
pname = "ansible-lint";
- version = "5.0.2";
+ version = "5.0.8";
disabled = isPy27;
format = "pyproject";
src = fetchPypi {
inherit pname version;
- sha256 = "sha256-vgt/KqNozTPaON/I19SybBZuo7bbl3Duq5dTBTMlj44=";
+ sha256 = "sha256-tnuWKEB66bwVuwu3H3mHG99ZP+/msGhMDMRL5fyQgD8=";
};
- postPatch = ''
- substituteInPlace src/ansiblelint/file_utils.py \
- --replace 'raise RuntimeError("Unable to determine file type for %s" % pathex)' 'return "playbook"'
- '';
+ nativeBuildInputs = [
+ setuptools-scm
+ ];
- buildInputs = [ python ];
+ propagatedBuildInputs = [
+ ansible-base
+ enrich
+ flaky
+ pyyaml
+ rich
+ ruamel-yaml
+ tenacity
+ wcmatch
+ yamllint
+ ];
- propagatedBuildInputs = [ ansible enrich pyyaml rich ruamel-yaml wcmatch ];
+ checkInputs = [
+ pytest-xdist
+ pytestCheckHook
+ ];
- checkInputs = [ pytestCheckHook pytest-xdist git ];
+ pytestFlagsArray = [
+ "--numprocesses" "auto"
+ ];
+
+ postPatch = ''
+ # Both patches are addressed in https://github.com/ansible-community/ansible-lint/pull/1549
+ # and should be removed once merged upstream
+
+ # fixes test_get_yaml_files_umlaut and test_run_inside_role_dir
+ substituteInPlace src/ansiblelint/file_utils.py \
+ --replace 'os.path.join(root, name)' 'os.path.normpath(os.path.join(root, name))'
+ # fixes test_custom_kinds
+ substituteInPlace src/ansiblelint/file_utils.py \
+ --replace "if name.endswith('.yaml') or name.endswith('.yml')" ""
+ '';
preCheck = ''
# ansible wants to write to $HOME and crashes if it can't
export HOME=$(mktemp -d)
- export PATH=$PATH:${lib.makeBinPath [ ansible ]}
+ 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_prerun_reqs_v1"
"test_prerun_reqs_v2"
- # Assertion error with negative numbers; maybe requieres an ansible update?
- "test_negative"
- "test_example"
- "test_playbook"
- "test_included_tasks"
- "test_long_line"
-
- "test_get_yaml_files_umlaut"
- "test_run_inside_role_dir"
- "test_role_handler_positive"
];
- # fails to run tests due to issues with temporary directory
- doCheck = !stdenv.isDarwin;
-
- makeWrapperArgs = [ "--prefix" "PATH" ":" (lib.makeBinPath [ ansible ]) ];
+ makeWrapperArgs = [ "--prefix" "PATH" ":" (lib.makeBinPath [ ansible-base ]) ];
meta = with lib; {
homepage = "https://github.com/ansible-community/ansible-lint";