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.fetchCargoTarball {
25 inherit src;
26 name = "${pname}-${version}";
27 hash = "sha256-a4jNofPIHoKwsD82y2hG2QPu+eM5D7FSGCm2nDo2cLA=";
28 };
29
30 nativeBuildInputs = with rustPlatform; [
31 bindgenHook
32 cargoSetupHook
33 maturinBuildHook
34 ];
35
36 checkInputs = [ pytestCheckHook ];
37
38 buildInputs = [ vectorscan ] ++ lib.optional stdenv.isDarwin libiconv;
39
40 pythonImportsCheck = [ "pyperscan" ];
41
42 meta = with lib; {
43 description = "Hyperscan binding for Python, which supports vectorscan";
44 homepage = "https://vlaci.github.io/pyperscan/";
45 changelog = "https://github.com/vlaci/pyperscan/releases/tag/${src.rev}";
46 platforms = platforms.unix;
47 license = with licenses; [
48 asl20 # or
49 mit
50 ];
51 maintainers = with maintainers; [
52 tnias
53 vlaci
54 ];
55 };
56}