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