1{ lib
2, antlr4-python3-runtime
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, setuptools
7, pytestCheckHook
8, wheel
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 "antlr4-python3-runtime~=" "antlr4-python3-runtime>="
29 '';
30
31 nativeBuildInputs = [
32 setuptools
33 wheel
34 ];
35
36 propagatedBuildInputs = [
37 antlr4-python3-runtime
38 six
39 ];
40
41 nativeCheckInputs = [
42 pytestCheckHook
43 ];
44
45 pythonImportsCheck = [
46 "stix2patterns"
47 ];
48
49 disabledTestPaths = [
50 # Exception: Could not deserialize ATN with version (expected 4)
51 "stix2patterns/test/v20/test_inspector.py"
52 "stix2patterns/test/v21/test_inspector.py"
53 "stix2patterns/test/v20/test_validator.py"
54 "stix2patterns/test/v21/test_validator.py"
55 ];
56
57 meta = with lib; {
58 description = "Validate patterns used to express cyber observable content in STIX Indicators";
59 homepage = "https://github.com/oasis-open/cti-pattern-validator";
60 changelog = "https://github.com/oasis-open/cti-pattern-validator/blob/${version}/CHANGELOG.rst";
61 license = licenses.bsd3;
62 maintainers = with maintainers; [ fab ];
63 };
64}