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