about summary refs log tree commit diff
path: root/pkgs/development/python-modules/whispers/default.nix
blob: 357d8d271ff49f1aef1bd32053a73b6e564edf81 (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
86
87
88
89
90
91
92
93
94
95
{ lib
, astroid
, beautifulsoup4
, buildPythonPackage
, crossplane
, fetchFromGitHub
, fetchpatch
, jellyfish
, jproperties
, luhn
, lxml
, pytest-mock
, pytestCheckHook
, pythonOlder
, pyyaml
, setuptools
}:

buildPythonPackage rec {
  pname = "whispers";
  version = "2.2.0";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "adeptex";
    repo = "whispers";
    rev = "refs/tags/${version}";
    hash = "sha256-9vXku8BWJtlf+lmAcQ8a7qTisRNc+xVw0T0Eunc4lt4=";
  };

  patches = [
    # Support astroid > 3, https://github.com/adeptex/whispers/pull/117
    (fetchpatch {
      url = "https://github.com/adeptex/whispers/commit/ff25e81cb3d775e5fb186c2d135b77c27d9ed43a.patch";
      hash = "sha256-jKm7fs04mGUD7MZYAA/3xt01e9knuLun3c3u8PlLebg=";
    })
    (fetchpatch {
      url = "https://github.com/adeptex/whispers/commit/ba6a56dddb12d1cb62f94dd7659ba24fdc4363ee.patch";
      hash = "sha256-eHWnXHT0lzS7BqneMqfvV3w6GfrCiTJ5i+av82J+fpk=";
    })
    (fetchpatch {
      url = "https://github.com/adeptex/whispers/commit/8b7b1593eb86abfc09b3581d463fc7d0e06309dc.patch";
      hash = "sha256-JcRdv5eIyXKWaVqbJZlYqiSieE4z0MKF4dvO/hRBBMs=";
    })
    (fetchpatch {
      url = "https://github.com/adeptex/whispers/commit/71dcb614e4d9e0247afc50cd4214659739f8844e.patch";
      hash = "sha256-7XIFuc8Rf2ValN3BoAJOjSqjgmiOauxCFonMgGljFg0=";
    })
  ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace '"pytest-runner"' ""
  '';

  nativeBuildInputs = [
    setuptools
  ];

  propagatedBuildInputs = [
    astroid
    beautifulsoup4
    crossplane
    jellyfish
    jproperties
    luhn
    lxml
    pyyaml
  ];

  nativeCheckInputs = [
    pytest-mock
    pytestCheckHook
  ];

  preCheck = ''
    # Some tests need the binary available in PATH
    export PATH=$out/bin:$PATH
  '';

  pythonImportsCheck = [
    "whispers"
  ];

  meta = with lib; {
    description = "Tool to identify hardcoded secrets in static structured text";
    mainProgram = "whispers";
    homepage = "https://github.com/adeptex/whispers";
    changelog = "https://github.com/adeptex/whispers/releases/tag/${version}";
    license = with licenses; [ asl20 ];
    maintainers = with maintainers; [ fab ];
  };
}