1{
2 lib,
3 astroid,
4 beautifulsoup4,
5 buildPythonPackage,
6 crossplane,
7 fetchFromGitHub,
8 jellyfish,
9 jproperties,
10 luhn,
11 lxml,
12 pytest-mock,
13 pytestCheckHook,
14 pythonOlder,
15 pyyaml,
16 wrapt,
17 semgrep,
18 setuptools,
19}:
20
21buildPythonPackage rec {
22 pname = "whispers";
23 version = "2.3.0";
24 pyproject = true;
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "adeptex";
30 repo = "whispers";
31 rev = "refs/tags/${version}";
32 hash = "sha256-tjDog8+oWTNuK1eK5qUEFspiilB0riUSTX5ugTIiP3M=";
33 };
34
35 postPatch = ''
36 substituteInPlace setup.py \
37 --replace-fail '"pytest-runner"' ""
38 '';
39
40 pythonRelaxDeps = [
41 "lxml"
42 "pyyaml"
43 "semgrep"
44 ];
45
46 build-system = [ setuptools ];
47
48 dependencies = [
49 astroid
50 beautifulsoup4
51 crossplane
52 jellyfish
53 jproperties
54 luhn
55 lxml
56 pyyaml
57 wrapt
58 semgrep
59 ];
60
61 nativeCheckInputs = [
62 pytest-mock
63 pytestCheckHook
64 ];
65
66 disabledTestPaths = [
67 # pinning tests highly sensitive to semgrep version
68 "tests/unit/plugins/test_semgrep.py"
69 ];
70
71 preCheck = ''
72 # pinning test highly sensitive to semgrep version
73 substituteInPlace tests/unit/test_main.py \
74 --replace-fail '("--ast", 421),' ""
75
76 # Some tests need the binary available in PATH
77 export PATH=$out/bin:$PATH
78 '';
79
80 pythonImportsCheck = [ "whispers" ];
81
82 meta = with lib; {
83 description = "Tool to identify hardcoded secrets in static structured text";
84 homepage = "https://github.com/adeptex/whispers";
85 changelog = "https://github.com/adeptex/whispers/releases/tag/${version}";
86 license = with licenses; [ asl20 ];
87 maintainers = with maintainers; [ fab ];
88 mainProgram = "whispers";
89 };
90}