Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 pytestCheckHook,
7 yara,
8}:
9
10buildPythonPackage rec {
11 pname = "yara-python";
12 version = "4.5.4";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "VirusTotal";
17 repo = "yara-python";
18 tag = "v${version}";
19 hash = "sha256-2ZwLpkT46KNTQ1ymvMGjnrfHQaIy/rXid0kXoCBixXA=";
20 };
21
22 # undefined symbol: yr_finalize
23 # https://github.com/VirusTotal/yara-python/issues/7
24 postPatch = ''
25 substituteInPlace setup.py \
26 --replace-fail "include_dirs=['yara/libyara/include', 'yara/libyara/', '.']" "libraries = ['yara']"
27 '';
28
29 build-system = [ setuptools ];
30
31 buildInputs = [ yara ];
32
33 nativeCheckInputs = [ pytestCheckHook ];
34
35 setupPyBuildFlags = [ "--dynamic-linking" ];
36
37 enabledTestPaths = [ "tests.py" ];
38
39 pythonImportsCheck = [ "yara" ];
40
41 meta = {
42 description = "Python interface for YARA";
43 homepage = "https://github.com/VirusTotal/yara-python";
44 changelog = "https://github.com/VirusTotal/yara-python/releases/tag/v${version}";
45 license = lib.licenses.asl20;
46 maintainers = with lib.maintainers; [ fab ];
47 };
48}