1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 pythonOlder, 6 installShellFiles, 7 docutils, 8 setuptools, 9 ansible, 10 cryptography, 11 jinja2, 12 junit-xml, 13 lxml, 14 ncclient, 15 packaging, 16 paramiko, 17 ansible-pylibssh, 18 pexpect, 19 psutil, 20 pycrypto, 21 pyyaml, 22 requests, 23 resolvelib, 24 scp, 25 windowsSupport ? false, 26 pywinrm, 27 xmltodict, 28}: 29 30buildPythonPackage rec { 31 pname = "ansible-core"; 32 version = "2.18.4"; 33 pyproject = true; 34 35 disabled = pythonOlder "3.11"; 36 37 src = fetchPypi { 38 pname = "ansible_core"; 39 inherit version; 40 hash = "sha256-4fj1wzVGNisO6TPglpo7o2S0hlFab6G8Jeu12V+OxfQ="; 41 }; 42 43 # ansible_connection is already wrapped, so don't pass it through 44 # the python interpreter again, as it would break execution of 45 # connection plugins. 46 postPatch = '' 47 substituteInPlace lib/ansible/executor/task_executor.py \ 48 --replace "[python," "[" 49 50 patchShebangs --build packaging/cli-doc/build.py 51 52 SETUPTOOLS_PATTERN='"setuptools[0-9 <>=.,]+"' 53 PYPROJECT=$(cat pyproject.toml) 54 if [[ "$PYPROJECT" =~ $SETUPTOOLS_PATTERN ]]; then 55 echo "setuptools replace: ''${BASH_REMATCH[0]}" 56 echo "''${PYPROJECT//''${BASH_REMATCH[0]}/'"setuptools"'}" > pyproject.toml 57 else 58 exit 2 59 fi 60 ''; 61 62 nativeBuildInputs = [ 63 installShellFiles 64 docutils 65 ]; 66 67 build-system = [ setuptools ]; 68 69 dependencies = [ 70 # depend on ansible instead of the other way around 71 ansible 72 # from requirements.txt 73 cryptography 74 jinja2 75 packaging 76 pyyaml 77 resolvelib 78 # optional dependencies 79 junit-xml 80 lxml 81 ncclient 82 paramiko 83 ansible-pylibssh 84 pexpect 85 psutil 86 pycrypto 87 requests 88 scp 89 xmltodict 90 ] ++ lib.optionals windowsSupport [ pywinrm ]; 91 92 pythonRelaxDeps = [ "resolvelib" ]; 93 94 postInstall = '' 95 export HOME="$(mktemp -d)" 96 packaging/cli-doc/build.py man --output-dir=man 97 installManPage man/* 98 ''; 99 100 # internal import errors, missing dependencies 101 doCheck = false; 102 103 meta = with lib; { 104 changelog = "https://github.com/ansible/ansible/blob/v${version}/changelogs/CHANGELOG-v${lib.versions.majorMinor version}.rst"; 105 description = "Radically simple IT automation"; 106 homepage = "https://www.ansible.com"; 107 license = licenses.gpl3Plus; 108 maintainers = [ ]; 109 }; 110}