1{ lib
2, pkgs
3, stdenv
4, buildPythonPackage
5, foma
6, icu
7, swig
8}:
9
10buildPythonPackage rec {
11 pname = "hfst";
12 inherit (pkgs.hfst) version src;
13
14 sourceRoot = "${src.name}/python";
15
16 postPatch = ''
17 # omorfi-python looks for 'hfst' Python package
18 sed -i 's/libhfst_swig/hfst/' setup.py;
19 '';
20
21 nativeBuildInputs = [
22 swig
23 ];
24
25 buildInputs = [
26 icu
27 pkgs.hfst
28 ];
29
30 setupPyBuildFlags = [
31 "--inplace"
32 ];
33
34 # Find foma in Darwin tests
35 preCheck = lib.optionalString stdenv.isDarwin ''
36 export DYLD_LIBRARY_PATH="${foma}/lib"
37 '';
38
39 meta = with lib; {
40 description = "Python bindings for HFST";
41 homepage = "https://github.com/hfst/hfst";
42 license = licenses.gpl3;
43 maintainers = with maintainers; [ lurkki ];
44 };
45}