1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 rustPlatform,
7 libiconv,
8}:
9
10buildPythonPackage rec {
11 pname = "python-flirt";
12 version = "0.9.7";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "williballenthin";
17 repo = "lancelot";
18 rev = "v${version}";
19 hash = "sha256-IgkfUkVsJyAsqH+L9GBdTQI1ure4k8mVLLWHj7AFDj8=";
20 };
21
22 postPatch = ''
23 ln -s ${./Cargo.lock} Cargo.lock
24 '';
25
26 nativeBuildInputs = with rustPlatform; [
27 cargoSetupHook
28 maturinBuildHook
29 ];
30
31 cargoDeps = rustPlatform.importCargoLock {
32 lockFile = ./Cargo.lock;
33 outputHashes = {
34 "ar-0.9.0" = "sha256-eyi1MlhJVvsiBOsetDHXFpdk+ABeZo/fVXNyvc5mw9s=";
35 };
36 };
37
38 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
39
40 buildAndTestSubdir = "pyflirt";
41
42 pythonImportsCheck = [ "flirt" ];
43
44 meta = with lib; {
45 description = "Python library for parsing, compiling, and matching Fast Library Identification and Recognition Technology (FLIRT) signatures";
46 homepage = "https://github.com/williballenthin/lancelot/tree/master/pyflirt";
47 license = licenses.asl20;
48 maintainers = with maintainers; [ sbruder ];
49 };
50}