1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 rustPlatform,
7 pytestCheckHook,
8 libiconv,
9 vectorscan,
10}:
11
12buildPythonPackage rec {
13 pname = "pyperscan";
14 version = "0.3.0";
15 format = "pyproject";
16
17 src = fetchFromGitHub {
18 owner = "vlaci";
19 repo = "pyperscan";
20 rev = "v${version}";
21 hash = "sha256-uGZ0XFxnZHSLEWcwoHVd+xMulDRqEIrQ5Lf7886GdlM=";
22 };
23
24 cargoDeps = rustPlatform.fetchCargoVendor {
25 inherit pname version src;
26 hash = "sha256-9kKHLYD0tXMGJFhsCBgO/NpWB4J5QZh0qKIuI3PFn2c=";
27 };
28
29 nativeBuildInputs = with rustPlatform; [
30 bindgenHook
31 cargoSetupHook
32 maturinBuildHook
33 ];
34
35 checkInputs = [ pytestCheckHook ];
36
37 buildInputs = [ vectorscan ] ++ lib.optional stdenv.hostPlatform.isDarwin libiconv;
38
39 pythonImportsCheck = [ "pyperscan" ];
40
41 meta = with lib; {
42 description = "Hyperscan binding for Python, which supports vectorscan";
43 homepage = "https://vlaci.github.io/pyperscan/";
44 changelog = "https://github.com/vlaci/pyperscan/releases/tag/${src.rev}";
45 platforms = platforms.unix;
46 license = with licenses; [
47 asl20 # or
48 mit
49 ];
50 maintainers = with maintainers; [
51 tnias
52 vlaci
53 ];
54 };
55}