summary refs log tree commit diff
path: root/pkgs/development/python-modules/ansible-lint/default.nix
diff options
context:
space:
mode:
authorThilo Uttendorfer <tlo@sengaya.de>2021-05-14 02:48:03 +0200
committerGitHub <noreply@github.com>2021-05-14 02:48:03 +0200
commit7cd876f22d58f2f977c1b8dfdb9d4316cdbd52ec (patch)
tree396fce52a44346fdf8db6e81dc30a1d0363dcdb7 /pkgs/development/python-modules/ansible-lint/default.nix
parent1cdf5f44364fe06ce3d0cded1d784e132e6f3354 (diff)
downloadnixpkgs-7cd876f22d58f2f977c1b8dfdb9d4316cdbd52ec.tar
nixpkgs-7cd876f22d58f2f977c1b8dfdb9d4316cdbd52ec.tar.gz
nixpkgs-7cd876f22d58f2f977c1b8dfdb9d4316cdbd52ec.tar.bz2
nixpkgs-7cd876f22d58f2f977c1b8dfdb9d4316cdbd52ec.tar.lz
nixpkgs-7cd876f22d58f2f977c1b8dfdb9d4316cdbd52ec.tar.xz
nixpkgs-7cd876f22d58f2f977c1b8dfdb9d4316cdbd52ec.tar.zst
nixpkgs-7cd876f22d58f2f977c1b8dfdb9d4316cdbd52ec.zip
pythonPackages.ansible-lint: 5.0.2 -> 5.0.8 (#122442)
Diffstat (limited to 'pkgs/development/python-modules/ansible-lint/default.nix')
-rw-r--r--pkgs/development/python-modules/ansible-lint/default.nix75
1 files changed, 45 insertions, 30 deletions
diff --git a/pkgs/development/python-modules/ansible-lint/default.nix b/pkgs/development/python-modules/ansible-lint/default.nix
index 8388cd33e08..c6d66bc5315 100644
--- a/pkgs/development/python-modules/ansible-lint/default.nix
+++ b/pkgs/development/python-modules/ansible-lint/default.nix
@@ -1,41 +1,66 @@
 { lib
-, stdenv
-, fetchPypi
 , buildPythonPackage
 , isPy27
+, fetchPypi
+, python
 , ansible
+, 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"'
-  '';
-
   buildInputs = [ python ];
 
-  propagatedBuildInputs = [ ansible enrich pyyaml rich ruamel-yaml wcmatch ];
+  propagatedBuildInputs = [
+    ansible
+    enrich
+    flaky
+    pyyaml
+    rich
+    ruamel-yaml
+    tenacity
+    wcmatch
+    yamllint
+  ];
+
+  checkInputs = [
+    pytest-xdist
+    pytestCheckHook
+  ];
+
+  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
 
-  checkInputs = [ pytestCheckHook pytest-xdist git ];
+    # 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
@@ -46,27 +71,17 @@ buildPythonPackage rec {
     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 ]}" ];
 
   meta = with lib; {