summary refs log tree commit diff
path: root/pkgs/development/python-modules/hyperscan/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/hyperscan/default.nix')
-rw-r--r--pkgs/development/python-modules/hyperscan/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/hyperscan/default.nix b/pkgs/development/python-modules/hyperscan/default.nix
new file mode 100644
index 00000000000..342dda967cf
--- /dev/null
+++ b/pkgs/development/python-modules/hyperscan/default.nix
@@ -0,0 +1,54 @@
+{ lib
+, pkgs
+, buildPythonPackage
+, fetchFromGitHub
+, pdm-backend
+, setuptools
+, wheel
+, pcre
+, pkg-config
+, pytestCheckHook
+, pytest-mock
+}:
+
+buildPythonPackage rec {
+  pname = "hyperscan";
+  version = "0.6.0";
+  pyproject = true;
+
+  src = fetchFromGitHub {
+    owner = "darvid";
+    repo = "python-hyperscan";
+    rev = "v${version}";
+    hash = "sha256-6PoV9rY9CkXkAMWN2QCnfU4S0OJD/6bzkqFgvEVqNjo=";
+  };
+
+  buildInputs = [
+    (pkgs.hyperscan.override { withStatic = true; })
+    # we need static pcre to be built, by default only shared library is built
+    (pcre.overrideAttrs { dontDisableStatic = 0; })
+  ];
+
+  nativeBuildInputs = [
+    pkg-config
+    pdm-backend
+    setuptools
+    wheel
+  ];
+
+  pythonImportsCheck = [ "hyperscan" ];
+
+  nativeCheckInputs = [
+    pytestCheckHook
+    pytest-mock
+  ];
+
+  meta = with lib; {
+    description = "A CPython extension for the Hyperscan regular expression matching library";
+    homepage = "https://github.com/darvid/python-hyperscan";
+    changelog = "https://github.com/darvid/python-hyperscan/blob/${src.rev}/CHANGELOG.md";
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+    license = licenses.mit;
+    maintainers = with maintainers; [ mbalatsko ];
+  };
+}