summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ansible-compat/default.nix
blob: de2a7f1f76f5dd9fc52cc6dd44e9261b6304b661 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,
  setuptools-scm,

  # dependencies
  pyyaml,
  subprocess-tee,

  # tests
  coreutils,
  ansible-core,
  flaky,
  pytest-mock,
  pytest-instafail,
  pytestCheckHook,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage rec {
  pname = "ansible-compat";
  version = "25.12.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ansible";
    repo = "ansible-compat";
    tag = "v${version}";
    hash = "sha256-nn0NKX6rqNKrSZd+p/oq/LmESAgvTkSOA08wq1xLY2I=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    ansible-core
    pyyaml
    subprocess-tee
  ];

  nativeCheckInputs = [
    ansible-core # ansible-config
    flaky
    pytest-mock
    pytest-instafail
    pytestCheckHook
    writableTmpDirAsHomeHook
  ];

  preCheck = ''
    substituteInPlace test/test_runtime.py \
      --replace-fail "printenv" "${lib.getExe' coreutils "printenv"}"
  '';

  disabledTests = [
    # require network
    "test_install_collection"
    "test_install_collection_from_disk"
    "test_install_collection_git"
    "test_load_plugins"
    "test_prepare_environment_with_collections"
    "test_prerun_reqs_v1"
    "test_prerun_reqs_v2"
    "test_require_collection_install"
    "test_require_collection_no_cache_dir"
    "test_require_collection_preexisting_broken"
    "test_require_collection_not_isolated"
    "test_runtime_has_playbook"
    "test_runtime_plugins"
    "test_runtime_example"
    "test_scan_sys_path"
    "test_upgrade_collection"
    "test_ro_venv"
  ];

  pythonImportsCheck = [ "ansible_compat" ];

  meta = {
    description = "Function collection that help interacting with various versions of Ansible";
    homepage = "https://github.com/ansible/ansible-compat";
    changelog = "https://github.com/ansible/ansible-compat/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}