1{
2 lib,
3 pkgs,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pdm-backend,
7 setuptools,
8 wheel,
9 pcre,
10 pkg-config,
11 pytestCheckHook,
12 pytest-mock,
13}:
14
15buildPythonPackage rec {
16 pname = "hyperscan";
17 version = "0.7.7";
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "darvid";
22 repo = "python-hyperscan";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-TNiGh89SnGi0WAqfYudsj7GaVhOifi8ZcmTrMtVbk+c=";
25 };
26
27 buildInputs = [
28 (pkgs.hyperscan.override { withStatic = true; })
29 # we need static pcre to be built, by default only shared library is built
30 (pcre.overrideAttrs { dontDisableStatic = 0; })
31 ];
32
33 nativeBuildInputs = [
34 pkg-config
35 pdm-backend
36 setuptools
37 wheel
38 ];
39
40 pythonImportsCheck = [ "hyperscan" ];
41
42 nativeCheckInputs = [
43 pytestCheckHook
44 pytest-mock
45 ];
46
47 meta = with lib; {
48 description = "A CPython extension for the Hyperscan regular expression matching library";
49 homepage = "https://github.com/darvid/python-hyperscan";
50 changelog = "https://github.com/darvid/python-hyperscan/blob/${src.rev}/CHANGELOG.md";
51 platforms = [
52 "x86_64-linux"
53 "x86_64-darwin"
54 ];
55 license = licenses.mit;
56 maintainers = with maintainers; [ mbalatsko ];
57 };
58}