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