summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/dns-lexicon/default.nix
blob: f5a5b212f3801895eb3f78acb59d668b97a1237e (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
  lib,
  beautifulsoup4,
  boto3,
  buildPythonPackage,
  cryptography,
  dnspython,
  fetchFromGitHub,
  localzone,
  oci,
  poetry-core,
  pyotp,
  pytest-vcr,
  pytestCheckHook,
  pyyaml,
  requests,
  softlayer,
  tldextract,
  zeep,
}:

buildPythonPackage rec {
  pname = "dns_lexicon";
  version = "3.16.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "Analogj";
    repo = "lexicon";
    tag = "v${version}";
    hash = "sha256-79/zz0TOCpx26TEo6gi9JDBQeVW2azWnxAjWr/FGRLA=";
  };

  # https://beautiful-soup-4.readthedocs.io/en/latest/#method-names
  postPatch = ''
    sed 's/\<findAll\>/find_all/g' \
      -i src/lexicon/_private/providers/*.py
    sed 's/\<renderContents\>/encode_contents/g' \
      -i src/lexicon/_private/providers/*.py
  '';

  nativeBuildInputs = [ poetry-core ];

  propagatedBuildInputs = [
    beautifulsoup4
    cryptography
    pyotp
    pyyaml
    requests
    tldextract
  ];

  optional-dependencies = {
    route53 = [ boto3 ];
    localzone = [ localzone ];
    softlayer = [ softlayer ];
    ddns = [ dnspython ];
    duckdns = [ dnspython ];
    oci = [ oci ];
    full = [
      boto3
      dnspython
      localzone
      oci
      softlayer
      zeep
    ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    pytest-vcr
  ]
  ++ optional-dependencies.full;

  enabledTestPaths = [ "tests/" ];

  disabledTestPaths = [
    # Needs network access
    "tests/providers/test_auto.py"
    # Needs network access (and an API token)
    "tests/providers/test_namecheap.py"
  ];

  disabledTests = [
    # Tests want to download Public Suffix List
    "test_client_legacy_init"
    "test_client_basic_init"
    "test_client_init"
    "test_client_parse_env"
    "test_missing"
    "action_is_correctly"
  ];

  pythonImportsCheck = [ "lexicon" ];

  meta = {
    description = "Manipulate DNS records on various DNS providers in a standardized way";
    mainProgram = "lexicon";
    homepage = "https://github.com/AnalogJ/lexicon";
    changelog = "https://github.com/AnalogJ/lexicon/blob/v${version}/CHANGELOG.md";
    license = with lib.licenses; [ mit ];
    maintainers = with lib.maintainers; [ aviallon ];
  };
}