python3Packages.espeak-phonemizer: init at 1.1.0

This commit is contained in:
Martin Weinelt 2023-01-12 18:08:32 +01:00
parent bd383edb36
commit fce5291adb
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
3 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,21 @@
diff --git a/espeak_phonemizer/__init__.py b/espeak_phonemizer/__init__.py
index a09472e..730a7f9 100644
--- a/espeak_phonemizer/__init__.py
+++ b/espeak_phonemizer/__init__.py
@@ -163,14 +163,10 @@ class Phonemizer:
# Already initialized
return
- self.libc = ctypes.cdll.LoadLibrary("libc.so.6")
+ self.libc = ctypes.cdll.LoadLibrary("@libc@")
self.libc.open_memstream.restype = ctypes.POINTER(ctypes.c_char)
- try:
- self.lib_espeak = ctypes.cdll.LoadLibrary("libespeak-ng.so")
- except OSError:
- # Try .so.1
- self.lib_espeak = ctypes.cdll.LoadLibrary("libespeak-ng.so.1")
+ self.lib_espeak = ctypes.cdll.LoadLibrary("@libespeak_ng@")
sample_rate = self.lib_espeak.espeak_Initialize(
Phonemizer.AUDIO_OUTPUT_SYNCHRONOUS, 0, None, 0

View file

@ -0,0 +1,42 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, substituteAll
, glibc
, espeak-ng
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "espeak-phonemizer";
version = "1.1.0";
format = "setuptools";
src = fetchFromGitHub {
owner = "rhasspy";
repo = "espeak-phonemizer";
rev = "refs/tags/v${version}";
hash = "sha256-qnJtS5iIARdg+umolzLHT3/nLon9syjxfTnMWHOmYPU=";
};
patches = [
(substituteAll {
src = ./cdll.patch;
libc = "${lib.getLib glibc}/lib/libc.so.6";
libespeak_ng = "${lib.getLib espeak-ng}/lib/libespeak-ng.so";
})
];
checkInputs = [
pytestCheckHook
];
meta = with lib; {
changelog = "https://github.com/rhasspy/espeak-phonemizer/releases/tag/v${version}";
description = "Uses ctypes and libespeak-ng to transform test into IPA phonemes";
homepage = "https://github.com/rhasspy/espeak-phonemizer";
license = licenses.mit;
maintainers = with maintainers; [ hexa ];
platforms = platforms.linux;
};
}

View file

@ -3045,6 +3045,8 @@ self: super: with self; {
eradicate = callPackage ../development/python-modules/eradicate { };
espeak-phonemizer = callPackage ../development/python-modules/espeak-phonemizer { };
esprima = callPackage ../development/python-modules/esprima { };
escapism = callPackage ../development/python-modules/escapism { };