1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6 installShellFiles,
7 docutils,
8 setuptools,
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.17.6";
35 pyproject = true;
36
37 src = fetchPypi {
38 pname = "ansible_core";
39 inherit version;
40 hash = "sha256-PlOXC3zr/irbObcRweL4u/y+2sgo2lHcA1ehkHBjjpU=";
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
53 nativeBuildInputs = [
54 installShellFiles
55 docutils
56 ];
57
58 build-system = [ setuptools ];
59
60 dependencies =
61 [
62 # depend on ansible instead of the other way around
63 ansible
64 # from requirements.txt
65 cryptography
66 jinja2
67 packaging
68 passlib
69 pyyaml
70 resolvelib
71 # optional dependencies
72 junit-xml
73 lxml
74 ncclient
75 paramiko
76 ansible-pylibssh
77 pexpect
78 psutil
79 pycrypto
80 requests
81 scp
82 xmltodict
83 ]
84 ++ lib.optionals windowsSupport [ pywinrm ]
85 ++ lib.optionals (pythonOlder "3.10") [ importlib-resources ];
86
87 pythonRelaxDeps = lib.optionals (pythonOlder "3.10") [ "importlib-resources" ];
88
89 postInstall = ''
90 export HOME="$(mktemp -d)"
91 packaging/cli-doc/build.py man --output-dir=man
92 installManPage man/*
93 '';
94
95 # internal import errors, missing dependencies
96 doCheck = false;
97
98 meta = with lib; {
99 changelog = "https://github.com/ansible/ansible/blob/v${version}/changelogs/CHANGELOG-v${lib.versions.majorMinor version}.rst";
100 description = "Radically simple IT automation";
101 homepage = "https://www.ansible.com";
102 license = licenses.gpl3Plus;
103 maintainers = [ ];
104 };
105}