1{ 2 lib, 3 stdenv, 4 ansible-core, 5 buildPythonPackage, 6 fetchPypi, 7 fetchpatch, 8 glibcLocales, 9 importlib-metadata, 10 mock, 11 openssh, 12 pbr, 13 pexpect, 14 psutil, 15 pytest-mock, 16 pytest-timeout, 17 pytest-xdist, 18 pytestCheckHook, 19 pythonOlder, 20 python-daemon, 21 pyyaml, 22 setuptools, 23 six, 24}: 25 26buildPythonPackage rec { 27 pname = "ansible-runner"; 28 version = "2.3.6"; 29 pyproject = true; 30 31 disabled = pythonOlder "3.8"; 32 33 src = fetchPypi { 34 inherit pname version; 35 hash = "sha256-shdKEtytLcLzQuqCh2iY9WigtmxTVoYAv4BXcVj8uhw="; 36 }; 37 38 patches = [ 39 (fetchpatch { 40 name = "fix-tests.patch"; 41 url = "https://github.com/ansible/ansible-runner/commit/0d522c90cfc1f305e118705a1b3335ccb9c1633d.patch"; 42 hash = "sha256-eTnQkftvjK0YHU+ovotRVSuVlvaVeXp5SvYk1DPCg88="; 43 excludes = [ 44 ".github/workflows/ci.yml" 45 "tox.ini" 46 ]; 47 }) 48 (fetchpatch { 49 # python 3.12 compat 50 url = "https://github.com/ansible/ansible-runner/commit/dc248497bb2375a363222ce755bf3a31f21d5f64.patch"; 51 hash = "sha256-QT28Iw0uENoO35rqZpYBcmJB/GNDEF4m86SKf6p0XQU="; 52 }) 53 ]; 54 55 build-system = [ 56 setuptools 57 pbr 58 ]; 59 60 dependencies = [ 61 ansible-core 62 psutil 63 pexpect 64 python-daemon 65 pyyaml 66 six 67 ] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ]; 68 69 nativeCheckInputs = [ 70 ansible-core # required to place ansible CLI onto the PATH in tests 71 glibcLocales 72 pytestCheckHook 73 pytest-mock 74 pytest-timeout 75 pytest-xdist 76 mock 77 openssh 78 ]; 79 80 preCheck = '' 81 export HOME=$(mktemp -d) 82 export PATH="$PATH:$out/bin"; 83 # avoid coverage flags 84 rm pytest.ini 85 ''; 86 87 disabledTests = [ 88 # Requires network access 89 "test_callback_plugin_task_args_leak" 90 "test_env_accuracy" 91 # Times out on slower hardware 92 "test_large_stdout_blob" 93 # Failed: DID NOT RAISE <class 'RuntimeError'> 94 "test_validate_pattern" 95 ]; 96 97 disabledTestPaths = 98 [ 99 # These tests unset PATH and then run executables like `bash` (see https://github.com/ansible/ansible-runner/pull/918) 100 "test/integration/test_runner.py" 101 "test/unit/test_runner.py" 102 ] 103 ++ lib.optionals stdenv.isDarwin [ 104 # Integration tests on Darwin are not regularly passing in ansible-runner's own CI 105 "test/integration" 106 # These tests write to `/tmp` which is not writable on Darwin 107 "test/unit/config/test__base.py" 108 ]; 109 110 pythonImportsCheck = [ "ansible_runner" ]; 111 112 meta = with lib; { 113 description = "Helps when interfacing with Ansible"; 114 mainProgram = "ansible-runner"; 115 homepage = "https://github.com/ansible/ansible-runner"; 116 license = licenses.asl20; 117 maintainers = with maintainers; [ ]; 118 }; 119}