blob: 35a2a459587cada39afe63196b5e2ba74d37c646 (
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
|
{ lib
, fetchFromGitHub
, callPackage
, semgrep-core
, buildPythonApplication
, pythonPackages
, pytestCheckHook
, git
}:
let
common = callPackage ./common.nix { };
in
buildPythonApplication rec {
pname = "semgrep";
inherit (common) version;
src = "${common.src}/cli";
SEMGREP_CORE_BIN = "${semgrep-core}/bin/semgrep-core";
postPatch = ''
substituteInPlace setup.py \
--replace "typing-extensions~=4.2" "typing-extensions" \
--replace "jsonschema~=3.2" "jsonschema" \
--replace "boltons~=21.0" "boltons"
# remove git submodule placeholders
rm -r ./src/semgrep/{lang,semgrep_interfaces}
# link submodule dependencies
ln -s ${common.langsSrc}/ ./src/semgrep/lang
ln -s ${common.interfacesSrc}/ ./src/semgrep/semgrep_interfaces
'';
doCheck = true;
checkInputs = [ git pytestCheckHook ] ++ (with pythonPackages; [
pytest-snapshot
pytest-mock
pytest-freezegun
types-freezegun
]);
disabledTests = [
# requires networking
"tests/unit/test_metric_manager.py"
];
preCheck = ''
# tests need a home directory
export HOME="$(mktemp -d)"
# disabledTestPaths doesn't manage to avoid the e2e tests
# remove them from pyproject.toml
# and remove need for pytest-split
substituteInPlace pyproject.toml \
--replace '"tests/e2e",' "" \
--replace 'addopts = "--splitting-algorithm=least_duration"' ""
'';
propagatedBuildInputs = with pythonPackages; [
attrs
boltons
colorama
click
click-option-group
glom
requests
ruamel-yaml
tqdm
packaging
jsonschema
wcmatch
peewee
defusedxml
urllib3
typing-extensions
python-lsp-jsonrpc
];
meta = common.meta // {
description = common.meta.description + " - cli";
};
}
|