about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/stix2-patterns/default.nix
blob: b291e2cd724272810bed5ad92bfcdaf5de9b1abe (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
{ lib
, antlr4-python3-runtime
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, setuptools
, pytestCheckHook
, wheel
, six
}:

buildPythonPackage rec {
  pname = "stix2-patterns";
  version = "2.0.0";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "oasis-open";
    repo = "cti-pattern-validator";
    rev = "refs/tags/v${version}";
    hash = "sha256-lFgnvI5a7U7/Qj4Pqjr3mx4TNDnC2/Ru7tVG7VggR7Y=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "antlr4-python3-runtime~=" "antlr4-python3-runtime>="
  '';

  nativeBuildInputs = [
    setuptools
    wheel
  ];

  propagatedBuildInputs = [
    antlr4-python3-runtime
    six
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "stix2patterns"
  ];

  disabledTestPaths = [
    # Exception: Could not deserialize ATN with version  (expected 4)
    "stix2patterns/test/v20/test_inspector.py"
    "stix2patterns/test/v21/test_inspector.py"
    "stix2patterns/test/v20/test_validator.py"
    "stix2patterns/test/v21/test_validator.py"
  ];

  meta = with lib; {
    description = "Validate patterns used to express cyber observable content in STIX Indicators";
    mainProgram = "validate-patterns";
    homepage = "https://github.com/oasis-open/cti-pattern-validator";
    changelog = "https://github.com/oasis-open/cti-pattern-validator/blob/${version}/CHANGELOG.rst";
    license = licenses.bsd3;
    maintainers = with maintainers; [ fab ];
  };
}