1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 ansible-core,
6 coreutils,
7 flaky,
8 pytest-mock,
9 pytestCheckHook,
10 pyyaml,
11 setuptools,
12 setuptools-scm,
13 subprocess-tee,
14 pythonOlder,
15}:
16
17buildPythonPackage rec {
18 pname = "ansible-compat";
19 version = "24.7.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.10";
23
24 src = fetchPypi {
25 pname = "ansible_compat";
26 inherit version;
27 hash = "sha256-e8egwgpQWh62/5h3Bx/iAzATBCkIfaKY4lCZoU9w0C8=";
28 };
29
30 nativeBuildInputs = [
31 setuptools
32 setuptools-scm
33 ];
34
35 dependencies = [
36 pyyaml
37 subprocess-tee
38 ];
39
40 preCheck = ''
41 export HOME=$(mktemp -d)
42 substituteInPlace test/test_runtime.py \
43 --replace-fail "printenv" "${coreutils}/bin/printenv"
44 '';
45
46 nativeCheckInputs = [
47 ansible-core
48 flaky
49 pytest-mock
50 pytestCheckHook
51 ];
52
53 disabledTests = [
54 # require network
55 "test_prepare_environment_with_collections"
56 "test_prerun_reqs_v1"
57 "test_prerun_reqs_v2"
58 "test_require_collection_wrong_version"
59 "test_require_collection"
60 "test_install_collection"
61 "test_install_collection_dest"
62 "test_upgrade_collection"
63 "test_require_collection_no_cache_dir"
64 "test_runtime_has_playbook"
65 "test_runtime_plugins"
66 "test_scan_sys_path"
67 ];
68
69 pythonImportsCheck = [ "ansible_compat" ];
70
71 meta = with lib; {
72 description = "Function collection that help interacting with various versions of Ansible";
73 homepage = "https://github.com/ansible/ansible-compat";
74 changelog = "https://github.com/ansible/ansible-compat/releases/tag/v${version}";
75 license = licenses.mit;
76 maintainers = with maintainers; [ dawidd6 ];
77 };
78}