1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8 setuptools-scm,
9
10 # dependencies
11 pyyaml,
12 subprocess-tee,
13
14 # tests
15 coreutils,
16 ansible-core,
17 flaky,
18 pytest-mock,
19 pytest-instafail,
20 pytestCheckHook,
21 writableTmpDirAsHomeHook,
22}:
23
24buildPythonPackage rec {
25 pname = "ansible-compat";
26 version = "25.8.1";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "ansible";
31 repo = "ansible-compat";
32 tag = "v${version}";
33 hash = "sha256-u1yBRhE4i30RAyFe5UtRPyVeOYRzec2VE2H5qmH3dGM=";
34 };
35
36 build-system = [
37 setuptools
38 setuptools-scm
39 ];
40
41 dependencies = [
42 ansible-core
43 pyyaml
44 subprocess-tee
45 ];
46
47 nativeCheckInputs = [
48 ansible-core # ansible-config
49 flaky
50 pytest-mock
51 pytest-instafail
52 pytestCheckHook
53 writableTmpDirAsHomeHook
54 ];
55
56 preCheck = ''
57 substituteInPlace test/test_runtime.py \
58 --replace-fail "printenv" "${lib.getExe' coreutils "printenv"}"
59 '';
60
61 disabledTests = [
62 # require network
63 "test_install_collection"
64 "test_install_collection_from_disk"
65 "test_install_collection_git"
66 "test_load_plugins"
67 "test_prepare_environment_with_collections"
68 "test_prerun_reqs_v1"
69 "test_prerun_reqs_v2"
70 "test_require_collection_install"
71 "test_require_collection_no_cache_dir"
72 "test_require_collection_preexisting_broken"
73 "test_require_collection_not_isolated"
74 "test_runtime_has_playbook"
75 "test_runtime_plugins"
76 "test_runtime_example"
77 "test_scan_sys_path"
78 "test_upgrade_collection"
79 "test_ro_venv"
80 ];
81
82 pythonImportsCheck = [ "ansible_compat" ];
83
84 meta = {
85 description = "Function collection that help interacting with various versions of Ansible";
86 homepage = "https://github.com/ansible/ansible-compat";
87 changelog = "https://github.com/ansible/ansible-compat/releases/tag/${src.tag}";
88 license = lib.licenses.mit;
89 maintainers = with lib.maintainers; [ dawidd6 ];
90 };
91}