aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/python-modules/phonemizer/default.nix
blob: 2d6531794313c96a8253139eb7288e285dd3dbd4 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ lib
, substituteAll
, buildPythonApplication
, fetchPypi
, python3Packages
, pkgs
, joblib
, segments
, attrs
, espeak-ng
, pytestCheckHook
, pytestrunner
, pytestcov
}:

buildPythonApplication rec {
  pname = "phonemizer";
  version = "2.2.1";

  src = fetchPypi {
    inherit pname version;
    sha256 = "127n4f10zxq60qd8xvlc1amji4wbghqb90rfp25rzdk716kvgwab";
  };

  postPatch = ''
    sed -i -e '/\'pytest-runner\'/d setup.py
  '';

  patches = [
    (substituteAll {
      src = ./backend-paths.patch;
      espeak = "${lib.getBin espeak-ng}/bin/espeak";
      # override festival path should you try to integrate it
      festival = "";
    })
    ./remove-intertwined-festival-test.patch
  ];

  propagatedBuildInputs = [
    joblib
    segments
    attrs
  ];

  preCheck = ''
    export HOME=$TMPDIR
  '';

  checkInputs = [
    pytestCheckHook
    pytestcov
  ];

  # We tried to package festvial, but were unable to get the backend running,
  # so let's disable related tests.
  pytestFlagsArray = [
    "--ignore=test/test_festival.py"
  ];

  disabledTests = [
    "test_festival"
    "test_relative"
    "test_absolute"
    "test_readme_festival_syll"
  ];

  meta = with lib; {
    homepage = "https://github.com/bootphon/phonemizer";
    description = "Simple text to phones converter for multiple languages";
    license = licenses.gpl3;
    maintainers = with maintainers; [ hexa ];
  };
}