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