about summary refs log tree commit diff
path: root/pkgs/development/python-modules/hfst/default.nix
blob: 37869ffad3e3e58589c7e6527fdd8d5a7e19d156 (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
{
  lib,
  pkgs,
  stdenv,
  buildPythonPackage,
  foma,
  icu,
  swig,
}:

buildPythonPackage rec {
  pname = "hfst";
  format = "setuptools";
  inherit (pkgs.hfst) version src;

  sourceRoot = "${src.name}/python";

  postPatch = ''
    # omorfi-python looks for 'hfst' Python package
    sed -i 's/libhfst_swig/hfst/' setup.py;
  '';

  nativeBuildInputs = [ swig ];

  buildInputs = [
    icu
    pkgs.hfst
  ];

  setupPyBuildFlags = [ "--inplace" ];

  # Find foma in Darwin tests
  preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
    export DYLD_LIBRARY_PATH="${foma}/lib"
  '';

  meta = with lib; {
    description = "Python bindings for HFST";
    homepage = "https://github.com/hfst/hfst";
    license = licenses.gpl3;
    maintainers = with maintainers; [ lurkki ];
  };
}