about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/ciscoconfparse/default.nix
blob: 33bd43c7043b5e5d3c641b6e1f848038bbda03bd (plain) (blame)
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
{ lib
, buildPythonPackage
, deprecat
, dnspython
, fetchFromGitHub
, loguru
, passlib
, poetry-core
, pytestCheckHook
, pythonOlder
, pythonRelaxDepsHook
, toml
}:

buildPythonPackage rec {
  pname = "ciscoconfparse";
  version = "1.7.24";
  format = "pyproject";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "mpenning";
    repo = pname;
    rev = "refs/tags/${version}";
    hash = "sha256-vL/CQdYcOP356EyRToviWylP1EBtxmeov6qkhfQNZ2Y=";
  };

  pythonRelaxDeps = [
    "loguru"
  ];

  postPatch = ''
    # The line below is in the [build-system] section, which is invalid and
    # rejected by PyPA's build tool. It belongs in [project] but upstream has
    # had problems with putting that there (see comment in pyproject.toml).
    sed -i '/requires-python/d' pyproject.toml

    substituteInPlace pyproject.toml \
      --replace '"poetry>=1.3.2",' ""

    patchShebangs tests
  '';

  nativeBuildInputs = [
    poetry-core
    pythonRelaxDepsHook
  ];

  propagatedBuildInputs = [
    passlib
    deprecat
    dnspython
    loguru
    toml
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  disabledTestPaths = [
    "tests/parse_test.py"
  ];

  disabledTests = [
    # Tests require network access
    "test_dns_lookup"
    "test_reverse_dns_lookup"
    # Path issues with configuration files
    "testParse_valid_filepath"
  ];

  pythonImportsCheck = [
    "ciscoconfparse"
  ];

  meta = with lib; {
    description = "Module to parse, audit, query, build, and modify Cisco IOS-style configurations";
    homepage = "https://github.com/mpenning/ciscoconfparse";
    changelog = "https://github.com/mpenning/ciscoconfparse/blob/${version}/CHANGES.md";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ astro ];
  };
}