1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5, pythonRelaxDepsHook
6, installShellFiles
7, ansible
8, cryptography
9, importlib-resources
10, jinja2
11, junit-xml
12, lxml
13, ncclient
14, packaging
15, paramiko
16, ansible-pylibssh
17, passlib
18, pexpect
19, psutil
20, pycrypto
21, pyyaml
22, requests
23, resolvelib
24, scp
25, windowsSupport ? false, pywinrm
26, xmltodict
27}:
28
29buildPythonPackage rec {
30 pname = "ansible-core";
31 version = "2.15.5";
32
33 src = fetchPypi {
34 inherit pname version;
35 hash = "sha256-jMU5y41DSa8//ZAccHIvenogOuZCfdrJX/31RqbkFgI=";
36 };
37
38 # ansible_connection is already wrapped, so don't pass it through
39 # the python interpreter again, as it would break execution of
40 # connection plugins.
41 postPatch = ''
42 substituteInPlace lib/ansible/executor/task_executor.py \
43 --replace "[python," "["
44 '';
45
46 nativeBuildInputs = [
47 installShellFiles
48 ] ++ lib.optionals (pythonOlder "3.10") [
49 pythonRelaxDepsHook
50 ];
51
52 propagatedBuildInputs = [
53 # depend on ansible instead of the other way around
54 ansible
55 # from requirements.txt
56 cryptography
57 jinja2
58 packaging
59 passlib
60 pyyaml
61 resolvelib # This library is a PITA, since ansible requires a very old version of it
62 # optional dependencies
63 junit-xml
64 lxml
65 ncclient
66 paramiko
67 ansible-pylibssh
68 pexpect
69 psutil
70 pycrypto
71 requests
72 scp
73 xmltodict
74 ] ++ lib.optionals windowsSupport [
75 pywinrm
76 ] ++ lib.optionals (pythonOlder "3.10") [
77 importlib-resources
78 ];
79
80 pythonRelaxDeps = lib.optionals (pythonOlder "3.10") [
81 "importlib-resources"
82 ];
83
84 postInstall = ''
85 installManPage docs/man/man1/*.1
86 '';
87
88 # internal import errors, missing dependencies
89 doCheck = false;
90
91 meta = with lib; {
92 changelog = "https://github.com/ansible/ansible/blob/v${version}/changelogs/CHANGELOG-v${lib.versions.majorMinor version}.rst";
93 description = "Radically simple IT automation";
94 homepage = "https://www.ansible.com";
95 license = licenses.gpl3Plus;
96 maintainers = with maintainers; [ ];
97 };
98}