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.2.2"; 15 format = "pyproject"; 16 17 src = fetchFromGitHub { 18 owner = "vlaci"; 19 repo = "pyperscan"; 20 rev = "v${version}"; 21 hash = "sha256-ioNGEmWy+lEzazF1RzMFS06jYLNYll3QSlWAF0AoU7Y="; 22 }; 23 24 cargoDeps = rustPlatform.fetchCargoTarball { 25 inherit src; 26 name = "${pname}-${version}"; 27 hash = "sha256-2zppyxJ+XaI/JCkp7s27/jgtSbwxnI4Yil5KT8WgrVI="; 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 # Disable default features to use the system vectorscan library instead of a vendored one. 41 maturinBuildFlags = [ "--no-default-features" ]; 42 43 pythonImportsCheck = [ "pyperscan" ]; 44 45 meta = with lib; { 46 description = "a hyperscan binding for Python, which supports vectorscan"; 47 homepage = "https://github.com/vlaci/pyperscan"; 48 platforms = platforms.unix; 49 license = with licenses; [ 50 asl20 # or 51 mit 52 ]; 53 maintainers = with maintainers; [ 54 tnias 55 vlaci 56 ]; 57 }; 58}