about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyperscan/default.nix
blob: 954da379d7ed6eb32b38cc570e6151c39eea87c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ lib
, stdenv
, fetchFromGitHub
, buildPythonPackage
, rustPlatform
, pytestCheckHook
, libiconv
, vectorscan
}:

buildPythonPackage rec {
  pname = "pyperscan";
  version = "0.2.2";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "vlaci";
    repo = "pyperscan";
    rev = "v${version}";
    hash = "sha256-ioNGEmWy+lEzazF1RzMFS06jYLNYll3QSlWAF0AoU7Y=";
  };

  cargoDeps = rustPlatform.fetchCargoTarball {
    inherit src;
    name = "${pname}-${version}";
    hash = "sha256-2zppyxJ+XaI/JCkp7s27/jgtSbwxnI4Yil5KT8WgrVI=";
  };

  nativeBuildInputs = with rustPlatform; [
    bindgenHook
    cargoSetupHook
    maturinBuildHook
  ];

  checkInputs = [ pytestCheckHook ];

  buildInputs = [ vectorscan ] ++ lib.optional stdenv.isDarwin libiconv;

  # Disable default features to use the system vectorscan library instead of a vendored one.
  maturinBuildFlags = [ "--no-default-features" ];

  pythonImportsCheck = [ "pyperscan" ];

  meta = with lib; {
    description = "a hyperscan binding for Python, which supports vectorscan";
    homepage = "https://github.com/vlaci/pyperscan";
    platforms = platforms.unix;
    license = with licenses; [ asl20 /* or */ mit ];
    maintainers = with maintainers; [ tnias vlaci ];
  };
}