Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / yaramod / default.nix
blob1f459858dfa076c7e6499966ab8c07809449f6c7
1 { lib
2 , buildPythonPackage
3 , cmake
4 , fetchFromGitHub
5 , pytestCheckHook
6 , libxcrypt
7 , pythonOlder
8 , gtest
9 , pybind11
10 , nlohmann_json
13 let
14   pog = fetchFromGitHub {
15     owner = "metthal";
16     repo = "pog";
17     rev = "b09bbf9cea573ee62aab7eccda896e37961d16cd";
18     hash = "sha256-El4WA92t2O/L4wUqH6Xj8w+ANtb6liRwafDhqn8jxjQ=";
19   };
21   buildPythonPackage rec {
22     pname = "yaramod";
23     version = "3.20.2";
24     format = "setuptools";
26     disabled = pythonOlder "3.7";
28     src = fetchFromGitHub {
29       owner = "avast";
30       repo = pname;
31       rev = "refs/tags/v${version}";
32       hash = "sha256-OLsTvG+qaUJlKdHwswGBifzoT/uNunrrVWQg7hJxkhE=";
33     };
35     postPatch = ''
36       rm -r deps/googletest deps/pog/ deps/pybind11/ deps/json/json.hpp
37       cp -r --no-preserve=all ${pog} deps/pog/
38       cp -r --no-preserve=all ${nlohmann_json.src}/single_include/nlohmann/json.hpp deps/json/
39       cp -r --no-preserve=all ${pybind11.src} deps/pybind11/
40       cp -r --no-preserve=all ${gtest.src} deps/googletest/
41     '';
43     dontUseCmakeConfigure = true;
45     buildInputs = [
46       libxcrypt
47     ];
49     nativeBuildInputs = [
50       cmake
51       pog
52       gtest
53     ];
55     setupPyBuildFlags = [
56       "--with-unit-tests"
57     ];
59     checkInputs = [
60       pytestCheckHook
61     ];
63     pytestFlagsArray = [
64       "tests/"
65     ];
67     pythonImportsCheck = [
68       "yaramod"
69     ];
71     meta = with lib; {
72       description = "Parsing of YARA rules into AST and building new rulesets in C++";
73       homepage = "https://github.com/avast/yaramod";
74       changelog = "https://github.com/avast/yaramod/blob/v${version}/CHANGELOG.md";
75       license = licenses.mit;
76       maintainers = with maintainers; [ msm ];
77     };
78   }