1{
2 lib,
3 antlr4-python3-runtime,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pytestCheckHook,
7 pythonOlder,
8 setuptools,
9 six,
10}:
11
12buildPythonPackage rec {
13 pname = "stix2-patterns";
14 version = "2.0.0";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "oasis-open";
21 repo = "cti-pattern-validator";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-lFgnvI5a7U7/Qj4Pqjr3mx4TNDnC2/Ru7tVG7VggR7Y=";
24 };
25
26 postPatch = ''
27 substituteInPlace setup.py \
28 --replace-fail "antlr4-python3-runtime~=" "antlr4-python3-runtime>="
29 '';
30
31 build-system = [ setuptools ];
32
33 dependencies = [
34 antlr4-python3-runtime
35 six
36 ];
37
38 nativeCheckInputs = [ pytestCheckHook ];
39
40 pythonImportsCheck = [ "stix2patterns" ];
41
42 disabledTestPaths = [
43 # Exception: Could not deserialize ATN with version (expected 4)
44 "stix2patterns/test/v20/test_inspector.py"
45 "stix2patterns/test/v21/test_inspector.py"
46 "stix2patterns/test/v20/test_validator.py"
47 "stix2patterns/test/v21/test_validator.py"
48 ];
49
50 meta = with lib; {
51 description = "Validate patterns used to express cyber observable content in STIX Indicators";
52 mainProgram = "validate-patterns";
53 homepage = "https://github.com/oasis-open/cti-pattern-validator";
54 changelog = "https://github.com/oasis-open/cti-pattern-validator/blob/${version}/CHANGELOG.rst";
55 license = licenses.bsd3;
56 maintainers = with maintainers; [ fab ];
57 };
58}