diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-12-06 19:57:55 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-02-08 13:48:30 +0000 |
commit | bf3aadfdd39aa197e18bade671fab6726349ffa4 (patch) | |
tree | 698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/pkgs/development/python-modules/phonemizer | |
parent | f4afc5a01d9539ce09e47494e679c51f80723d07 (diff) | |
parent | 99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff) | |
download | nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2 nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip |
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/phonemizer')
4 files changed, 123 insertions, 74 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/phonemizer/backend-paths.patch b/nixpkgs/pkgs/development/python-modules/phonemizer/backend-paths.patch index 5f828aaaae13..4b9f1fb4a70b 100644 --- a/nixpkgs/pkgs/development/python-modules/phonemizer/backend-paths.patch +++ b/nixpkgs/pkgs/development/python-modules/phonemizer/backend-paths.patch @@ -1,42 +1,18 @@ -diff --git a/phonemizer/backend/espeak.py b/phonemizer/backend/espeak.py -index b4712bf..5628fd5 100644 ---- a/phonemizer/backend/espeak.py -+++ b/phonemizer/backend/espeak.py -@@ -82,10 +82,7 @@ class BaseEspeakBackend(BaseBackend): - if _ESPEAK_DEFAULT_PATH: - return _ESPEAK_DEFAULT_PATH +diff --git a/phonemizer/backend/espeak/wrapper.py b/phonemizer/backend/espeak/wrapper.py +index 84a79f5..8abcae1 100644 +--- a/phonemizer/backend/espeak/wrapper.py ++++ b/phonemizer/backend/espeak/wrapper.py +@@ -143,12 +143,7 @@ class EspeakWrapper: + f'is not a readable file') + return library.resolve() -- espeak = distutils.spawn.find_executable('espeak-ng') -- if not espeak: # pragma: nocover -- espeak = distutils.spawn.find_executable('espeak') -- return espeak -+ return "@espeak@" +- library = ( +- ctypes.util.find_library('espeak-ng') or +- ctypes.util.find_library('espeak')) +- if not library: # pragma: nocover +- raise RuntimeError( +- 'failed to find espeak library') ++ library = '@libespeak@' + return library - @classmethod - def is_available(cls): -diff --git a/phonemizer/backend/festival.py b/phonemizer/backend/festival.py -index 3037be5..684ffff 100644 ---- a/phonemizer/backend/festival.py -+++ b/phonemizer/backend/festival.py -@@ -80,7 +80,7 @@ class FestivalBackend(BaseBackend): - if _FESTIVAL_DEFAULT_PATH: - return _FESTIVAL_DEFAULT_PATH - -- return distutils.spawn.find_executable('festival') -+ return "@festival@" - - @classmethod - def is_available(cls): -diff --git a/test/test_punctuation.py b/test/test_punctuation.py -index 6ed642a..08060df 100644 ---- a/test/test_punctuation.py -+++ b/test/test_punctuation.py -@@ -28,7 +28,7 @@ ESPEAK_143 = (EspeakBackend.version(as_tuple=True) >= (1, 49, 3)) - ESPEAK_150 = (EspeakBackend.version(as_tuple=True) >= (1, 50)) - - # True if we are using festival>=2.5 --FESTIVAL_25 = (FestivalBackend.version(as_tuple=True) >= (2, 5)) -+FESTIVAL_25 = False - - - @pytest.mark.parametrize( + def _fetch_version_and_path(self): diff --git a/nixpkgs/pkgs/development/python-modules/phonemizer/default.nix b/nixpkgs/pkgs/development/python-modules/phonemizer/default.nix index 29f7266b6910..550a4fefd25a 100644 --- a/nixpkgs/pkgs/development/python-modules/phonemizer/default.nix +++ b/nixpkgs/pkgs/development/python-modules/phonemizer/default.nix @@ -1,10 +1,13 @@ { lib +, stdenv , substituteAll , buildPythonApplication , fetchPypi , joblib , segments , attrs +, dlinfo +, typing-extensions , espeak-ng , pytestCheckHook , pytest-cov @@ -12,11 +15,11 @@ buildPythonApplication rec { pname = "phonemizer"; - version = "3.0.1"; + version = "3.2.1"; src = fetchPypi { inherit pname version; - sha256 = "1b4ea53b8da9a156361dff1d0c04ac1a8e65e6966d1cb9a8147c200960b32296"; + sha256 = "sha256-Bo+F+FqKmtxjijeHrqyvcaU+R1eLEtdzwJdDNQDNiSs="; }; postPatch = '' @@ -26,9 +29,8 @@ buildPythonApplication rec { patches = [ (substituteAll { src = ./backend-paths.patch; - espeak = "${lib.getBin espeak-ng}/bin/espeak"; - # override festival path should you try to integrate it - festival = ""; + libespeak = "${lib.getLib espeak-ng}/lib/libespeak-ng${stdenv.hostPlatform.extensions.sharedLibrary}"; + # FIXME package festival }) ./remove-intertwined-festival-test.patch ]; @@ -37,6 +39,8 @@ buildPythonApplication rec { joblib segments attrs + dlinfo + typing-extensions ]; preCheck = '' @@ -45,26 +49,26 @@ buildPythonApplication rec { checkInputs = [ pytestCheckHook - pytest-cov ]; # 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" + disabledTestPaths = [ + "test/test_festival.py" ]; disabledTests = [ "test_festival" - "test_relative" - "test_absolute" + "test_festival_path" "test_readme_festival_syll" + "test_unicode" ]; meta = with lib; { homepage = "https://github.com/bootphon/phonemizer"; + changelog = "https://github.com/bootphon/phonemizer/blob/v${version}/CHANGELOG.md"; description = "Simple text to phones converter for multiple languages"; - license = licenses.gpl3; + license = licenses.gpl3Plus; maintainers = with maintainers; [ ]; }; } diff --git a/nixpkgs/pkgs/development/python-modules/phonemizer/drop-readme-festival-test.patch b/nixpkgs/pkgs/development/python-modules/phonemizer/drop-readme-festival-test.patch deleted file mode 100644 index a60cdf2645a5..000000000000 --- a/nixpkgs/pkgs/development/python-modules/phonemizer/drop-readme-festival-test.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/test/test_main.py b/test/test_main.py -index 71d605a..d137cd7 100644 ---- a/test/test_main.py -+++ b/test/test_main.py -@@ -63,7 +63,6 @@ def test_readme(): - _test(u'hello world', u'həloʊ wɜːld ') - _test(u'hello world', u'həloʊ wɜːld ', '--verbose') - _test(u'hello world', u'həloʊ wɜːld ', '--quiet') -- _test(u'hello world', u'hhaxlow werld', '-b festival --strip') - _test(u'hello world', u'həloʊ wɜːld ', '-l en-us') - _test(u'bonjour le monde', u'bɔ̃ʒuʁ lə mɔ̃d ', '-l fr-fr') - _test(u'bonjour le monde', u'b ɔ̃ ʒ u ʁ ;eword l ə ;eword m ɔ̃ d ;eword ', diff --git a/nixpkgs/pkgs/development/python-modules/phonemizer/remove-intertwined-festival-test.patch b/nixpkgs/pkgs/development/python-modules/phonemizer/remove-intertwined-festival-test.patch index d7d605df7f98..a0e0817bb72a 100644 --- a/nixpkgs/pkgs/development/python-modules/phonemizer/remove-intertwined-festival-test.patch +++ b/nixpkgs/pkgs/development/python-modules/phonemizer/remove-intertwined-festival-test.patch @@ -1,15 +1,14 @@ diff --git a/test/test_main.py b/test/test_main.py -index 71d605a..0ea3c74 100644 +index b8c53e9..8f8c6d2 100644 --- a/test/test_main.py +++ b/test/test_main.py -@@ -63,17 +63,12 @@ def test_readme(): - _test(u'hello world', u'həloʊ wɜːld ') - _test(u'hello world', u'həloʊ wɜːld ', '--verbose') - _test(u'hello world', u'həloʊ wɜːld ', '--quiet') -- _test(u'hello world', u'hhaxlow werld', '-b festival --strip') - _test(u'hello world', u'həloʊ wɜːld ', '-l en-us') - _test(u'bonjour le monde', u'bɔ̃ʒuʁ lə mɔ̃d ', '-l fr-fr') - _test(u'bonjour le monde', u'b ɔ̃ ʒ u ʁ ;eword l ə ;eword m ɔ̃ d ;eword ', +@@ -68,16 +68,11 @@ def test_readme(): + _test('hello world', 'həloʊ wɜːld ', '--verbose') + _test('hello world', 'həloʊ wɜːld ', '--quiet') + _test('hello world', 'hello world | həloʊ wɜːld ', '--prepend-text') +- _test('hello world', 'hhaxlow werld', '-b festival --strip') + _test('bonjour le monde', 'bɔ̃ʒuʁ lə mɔ̃d ', '-l fr-fr') + _test('bonjour le monde', 'b ɔ̃ ʒ u ʁ ;eword l ə ;eword m ɔ̃ d ;eword ', '-l fr-fr -p " " -w ";eword "') @@ -18,5 +17,87 @@ index 71d605a..0ea3c74 100644 - reason='festival-2.1 gives different results than further versions ' - 'for syllable boundaries') def test_readme_festival_syll(): - _test(u'hello world', - u'hh ax ;esyll l ow ;esyll ;eword w er l d ;esyll ;eword ', + _test('hello world', + 'hh ax ;esyll l ow ;esyll ;eword w er l d ;esyll ;eword ', +diff --git a/test/test_phonemize.py b/test/test_phonemize.py +index d156c9e..2bbe371 100644 +--- a/test/test_phonemize.py ++++ b/test/test_phonemize.py +@@ -213,18 +213,6 @@ def test_segments(njobs): + ('segments', True, True, False, + ['achi acho?', '', 'achi acho'], + [u'ʌtʃɪ ʌtʃʊ?', '', u'ʌtʃɪ ʌtʃʊ ']), +- ('festival', False, False, False, +- ['hello world!', '', 'goodbye'], +- ['hhaxlow werld ', 'guhdbay ']), +- ('festival', False, True, False, +- ['hello world!', '', 'goodbye'], +- ['hhaxlow werld!', 'guhdbay ']), +- ('festival', True, False, False, +- ['hello world!', '', 'goodbye'], +- ['hhaxlow werld ', '', 'guhdbay ']), +- ('festival', True, True, False, +- ['hello world!', '', 'goodbye'], +- ['hhaxlow werld!', '', 'guhdbay ']), + ('espeak', False, False, True, + ['hello world!', '', 'goodbye'], + [('hello world!', 'həloʊ wɜːld '), ('goodbye', 'ɡʊdbaɪ ')]), +@@ -248,19 +236,7 @@ def test_segments(njobs): + [('achi acho?', u'ʌtʃɪ ʌtʃʊ '), ('', ''), ('achi acho', u'ʌtʃɪ ʌtʃʊ ')]), + ('segments', True, True, True, + ['achi acho?', '', 'achi acho'], +- [('achi acho?', u'ʌtʃɪ ʌtʃʊ?'), ('', ''), ('achi acho', u'ʌtʃɪ ʌtʃʊ ')]), +- ('festival', False, False, True, +- ['hello world!', '', 'goodbye'], +- [('hello world!', 'hhaxlow werld '), ('goodbye', 'guhdbay ')]), +- ('festival', False, True, True, +- ['hello world!', '', 'goodbye'], +- [('hello world!', 'hhaxlow werld!'), ('goodbye', 'guhdbay ')]), +- ('festival', True, False, True, +- ['hello world!', '', 'goodbye'], +- [('hello world!', 'hhaxlow werld '), ('', ''), ('goodbye', 'guhdbay ')]), +- ('festival', True, True, True, +- ['hello world!', '', 'goodbye'], +- [('hello world!', 'hhaxlow werld!'), ('', ''), ('goodbye', 'guhdbay ')])]) ++ [('achi acho?', u'ʌtʃɪ ʌtʃʊ?'), ('', ''), ('achi acho', u'ʌtʃɪ ʌtʃʊ ')])]) + def test_preserve_empty_lines(backend, empty_lines, punctuation, prepend_text, text, expected): + language = 'cree' if backend == 'segments' else 'en-us' + +@@ -278,11 +254,7 @@ def test_preserve_empty_lines(backend, empty_lines, punctuation, prepend_text, t + ('segments', False, False, [''], []), + ('segments', False, True, [''], []), + ('segments', True, False, [''], ['']), +- ('segments', True, True, [''], ['']), +- ('festival', False, False, [''], []), +- ('festival', False, True, [''], []), +- ('festival', True, False, [''], ['']), +- ('festival', True, True, [''], [''])]) ++ ('segments', True, True, [''], [''])]) + def test_empty_input(backend, empty_lines, punctuation, text, expected): + language = 'cree' if backend == 'segments' else 'en-us' + +diff --git a/test/test_punctuation.py b/test/test_punctuation.py +index b2206ac..62e31c1 100644 +--- a/test/test_punctuation.py ++++ b/test/test_punctuation.py +@@ -28,9 +28,6 @@ ESPEAK_150 = (EspeakBackend.version() >= (1, 50)) + # True if we are using espeak>=1.49.3 + ESPEAK_143 = (EspeakBackend.version() >= (1, 49, 3)) + +-# True if we are using festival>=2.5 +-FESTIVAL_25 = (FestivalBackend.version() >= (2, 5)) +- + + @pytest.mark.parametrize( + 'inp, out', [ +@@ -179,9 +176,7 @@ def test_issue_54(text): + ('espeak', 'default', ['! ?', 'hey!'], ['! ?', 'heɪ!']), + ('espeak', '!', ['! ?', 'hey!'], ['! ', 'heɪ!']), + ('segments', 'default', ['! ?', 'hey!'], ['! ?', 'heːj!']), +- ('segments', '!', ['! ?', 'hey!'], ValueError), +- ('festival', 'default', ['! ?', 'hey!'], ['! ?', 'hhey!']), +- ('festival', '!', ['! ?', 'hey!'], ['! ', 'hhey!'])]) ++ ('segments', '!', ['! ?', 'hey!'], ValueError)]) + def test_issue55(backend, marks, text, expected): + if marks == 'default': + marks = Punctuation.default_marks() |