lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

python3Packages.phonemizer: fix build

+121 -72
+16 -40
pkgs/development/python-modules/phonemizer/backend-paths.patch
··· 1 - diff --git a/phonemizer/backend/espeak.py b/phonemizer/backend/espeak.py 2 - index b4712bf..5628fd5 100644 3 - --- a/phonemizer/backend/espeak.py 4 - +++ b/phonemizer/backend/espeak.py 5 - @@ -82,10 +82,7 @@ class BaseEspeakBackend(BaseBackend): 6 - if _ESPEAK_DEFAULT_PATH: 7 - return _ESPEAK_DEFAULT_PATH 8 - 9 - - espeak = distutils.spawn.find_executable('espeak-ng') 10 - - if not espeak: # pragma: nocover 11 - - espeak = distutils.spawn.find_executable('espeak') 12 - - return espeak 13 - + return "@espeak@" 14 - 15 - @classmethod 16 - def is_available(cls): 17 - diff --git a/phonemizer/backend/festival.py b/phonemizer/backend/festival.py 18 - index 3037be5..684ffff 100644 19 - --- a/phonemizer/backend/festival.py 20 - +++ b/phonemizer/backend/festival.py 21 - @@ -80,7 +80,7 @@ class FestivalBackend(BaseBackend): 22 - if _FESTIVAL_DEFAULT_PATH: 23 - return _FESTIVAL_DEFAULT_PATH 24 - 25 - - return distutils.spawn.find_executable('festival') 26 - + return "@festival@" 27 - 28 - @classmethod 29 - def is_available(cls): 30 - diff --git a/test/test_punctuation.py b/test/test_punctuation.py 31 - index 6ed642a..08060df 100644 32 - --- a/test/test_punctuation.py 33 - +++ b/test/test_punctuation.py 34 - @@ -28,7 +28,7 @@ ESPEAK_143 = (EspeakBackend.version(as_tuple=True) >= (1, 49, 3)) 35 - ESPEAK_150 = (EspeakBackend.version(as_tuple=True) >= (1, 50)) 36 - 37 - # True if we are using festival>=2.5 38 - -FESTIVAL_25 = (FestivalBackend.version(as_tuple=True) >= (2, 5)) 39 - +FESTIVAL_25 = False 1 + diff --git a/phonemizer/backend/espeak/wrapper.py b/phonemizer/backend/espeak/wrapper.py 2 + index 84a79f5..8abcae1 100644 3 + --- a/phonemizer/backend/espeak/wrapper.py 4 + +++ b/phonemizer/backend/espeak/wrapper.py 5 + @@ -143,12 +143,7 @@ class EspeakWrapper: 6 + f'is not a readable file') 7 + return library.resolve() 40 8 9 + - library = ( 10 + - ctypes.util.find_library('espeak-ng') or 11 + - ctypes.util.find_library('espeak')) 12 + - if not library: # pragma: nocover 13 + - raise RuntimeError( 14 + - 'failed to find espeak library') 15 + + library = '@libespeak@' 16 + return library 41 17 42 - @pytest.mark.parametrize( 18 + def _fetch_version_and_path(self):
+13 -9
pkgs/development/python-modules/phonemizer/default.nix
··· 1 1 { lib 2 + , stdenv 2 3 , substituteAll 3 4 , buildPythonApplication 4 5 , fetchPypi 5 6 , joblib 6 7 , segments 7 8 , attrs 9 + , dlinfo 10 + , typing-extensions 8 11 , espeak-ng 9 12 , pytestCheckHook 10 13 , pytest-cov ··· 26 29 patches = [ 27 30 (substituteAll { 28 31 src = ./backend-paths.patch; 29 - espeak = "${lib.getBin espeak-ng}/bin/espeak"; 30 - # override festival path should you try to integrate it 31 - festival = ""; 32 + libespeak = "${lib.getLib espeak-ng}/lib/libespeak-ng${stdenv.hostPlatform.extensions.sharedLibrary}"; 33 + # FIXME package festival 32 34 }) 33 35 ./remove-intertwined-festival-test.patch 34 36 ]; ··· 37 39 joblib 38 40 segments 39 41 attrs 42 + dlinfo 43 + typing-extensions 40 44 ]; 41 45 42 46 preCheck = '' ··· 45 49 46 50 checkInputs = [ 47 51 pytestCheckHook 48 - pytest-cov 49 52 ]; 50 53 51 54 # We tried to package festvial, but were unable to get the backend running, 52 55 # so let's disable related tests. 53 - pytestFlagsArray = [ 54 - "--ignore=test/test_festival.py" 56 + disabledTestPaths = [ 57 + "test/test_festival.py" 55 58 ]; 56 59 57 60 disabledTests = [ 58 61 "test_festival" 59 - "test_relative" 60 - "test_absolute" 62 + "test_festival_path" 61 63 "test_readme_festival_syll" 64 + "test_unicode" 62 65 ]; 63 66 64 67 meta = with lib; { 65 68 homepage = "https://github.com/bootphon/phonemizer"; 69 + changelog = "https://github.com/bootphon/phonemizer/blob/v${version}/CHANGELOG.md"; 66 70 description = "Simple text to phones converter for multiple languages"; 67 - license = licenses.gpl3; 71 + license = licenses.gpl3Plus; 68 72 maintainers = with maintainers; [ ]; 69 73 }; 70 74 }
-12
pkgs/development/python-modules/phonemizer/drop-readme-festival-test.patch
··· 1 - diff --git a/test/test_main.py b/test/test_main.py 2 - index 71d605a..d137cd7 100644 3 - --- a/test/test_main.py 4 - +++ b/test/test_main.py 5 - @@ -63,7 +63,6 @@ def test_readme(): 6 - _test(u'hello world', u'həloʊ wɜːld ') 7 - _test(u'hello world', u'həloʊ wɜːld ', '--verbose') 8 - _test(u'hello world', u'həloʊ wɜːld ', '--quiet') 9 - - _test(u'hello world', u'hhaxlow werld', '-b festival --strip') 10 - _test(u'hello world', u'həloʊ wɜːld ', '-l en-us') 11 - _test(u'bonjour le monde', u'bɔ̃ʒuʁ lə mɔ̃d ', '-l fr-fr') 12 - _test(u'bonjour le monde', u'b ɔ̃ ʒ u ʁ ;eword l ə ;eword m ɔ̃ d ;eword ',
+92 -11
pkgs/development/python-modules/phonemizer/remove-intertwined-festival-test.patch
··· 1 1 diff --git a/test/test_main.py b/test/test_main.py 2 - index 71d605a..0ea3c74 100644 2 + index b8c53e9..8f8c6d2 100644 3 3 --- a/test/test_main.py 4 4 +++ b/test/test_main.py 5 - @@ -63,17 +63,12 @@ def test_readme(): 6 - _test(u'hello world', u'həloʊ wɜːld ') 7 - _test(u'hello world', u'həloʊ wɜːld ', '--verbose') 8 - _test(u'hello world', u'həloʊ wɜːld ', '--quiet') 9 - - _test(u'hello world', u'hhaxlow werld', '-b festival --strip') 10 - _test(u'hello world', u'həloʊ wɜːld ', '-l en-us') 11 - _test(u'bonjour le monde', u'bɔ̃ʒuʁ lə mɔ̃d ', '-l fr-fr') 12 - _test(u'bonjour le monde', u'b ɔ̃ ʒ u ʁ ;eword l ə ;eword m ɔ̃ d ;eword ', 5 + @@ -68,16 +68,11 @@ def test_readme(): 6 + _test('hello world', 'həloʊ wɜːld ', '--verbose') 7 + _test('hello world', 'həloʊ wɜːld ', '--quiet') 8 + _test('hello world', 'hello world | həloʊ wɜːld ', '--prepend-text') 9 + - _test('hello world', 'hhaxlow werld', '-b festival --strip') 10 + _test('bonjour le monde', 'bɔ̃ʒuʁ lə mɔ̃d ', '-l fr-fr') 11 + _test('bonjour le monde', 'b ɔ̃ ʒ u ʁ ;eword l ə ;eword m ɔ̃ d ;eword ', 13 12 '-l fr-fr -p " " -w ";eword "') 14 13 15 14 ··· 18 17 - reason='festival-2.1 gives different results than further versions ' 19 18 - 'for syllable boundaries') 20 19 def test_readme_festival_syll(): 21 - _test(u'hello world', 22 - u'hh ax ;esyll l ow ;esyll ;eword w er l d ;esyll ;eword ', 20 + _test('hello world', 21 + 'hh ax ;esyll l ow ;esyll ;eword w er l d ;esyll ;eword ', 22 + diff --git a/test/test_phonemize.py b/test/test_phonemize.py 23 + index d156c9e..2bbe371 100644 24 + --- a/test/test_phonemize.py 25 + +++ b/test/test_phonemize.py 26 + @@ -213,18 +213,6 @@ def test_segments(njobs): 27 + ('segments', True, True, False, 28 + ['achi acho?', '', 'achi acho'], 29 + [u'ʌtʃɪ ʌtʃʊ?', '', u'ʌtʃɪ ʌtʃʊ ']), 30 + - ('festival', False, False, False, 31 + - ['hello world!', '', 'goodbye'], 32 + - ['hhaxlow werld ', 'guhdbay ']), 33 + - ('festival', False, True, False, 34 + - ['hello world!', '', 'goodbye'], 35 + - ['hhaxlow werld!', 'guhdbay ']), 36 + - ('festival', True, False, False, 37 + - ['hello world!', '', 'goodbye'], 38 + - ['hhaxlow werld ', '', 'guhdbay ']), 39 + - ('festival', True, True, False, 40 + - ['hello world!', '', 'goodbye'], 41 + - ['hhaxlow werld!', '', 'guhdbay ']), 42 + ('espeak', False, False, True, 43 + ['hello world!', '', 'goodbye'], 44 + [('hello world!', 'həloʊ wɜːld '), ('goodbye', 'ɡʊdbaɪ ')]), 45 + @@ -248,19 +236,7 @@ def test_segments(njobs): 46 + [('achi acho?', u'ʌtʃɪ ʌtʃʊ '), ('', ''), ('achi acho', u'ʌtʃɪ ʌtʃʊ ')]), 47 + ('segments', True, True, True, 48 + ['achi acho?', '', 'achi acho'], 49 + - [('achi acho?', u'ʌtʃɪ ʌtʃʊ?'), ('', ''), ('achi acho', u'ʌtʃɪ ʌtʃʊ ')]), 50 + - ('festival', False, False, True, 51 + - ['hello world!', '', 'goodbye'], 52 + - [('hello world!', 'hhaxlow werld '), ('goodbye', 'guhdbay ')]), 53 + - ('festival', False, True, True, 54 + - ['hello world!', '', 'goodbye'], 55 + - [('hello world!', 'hhaxlow werld!'), ('goodbye', 'guhdbay ')]), 56 + - ('festival', True, False, True, 57 + - ['hello world!', '', 'goodbye'], 58 + - [('hello world!', 'hhaxlow werld '), ('', ''), ('goodbye', 'guhdbay ')]), 59 + - ('festival', True, True, True, 60 + - ['hello world!', '', 'goodbye'], 61 + - [('hello world!', 'hhaxlow werld!'), ('', ''), ('goodbye', 'guhdbay ')])]) 62 + + [('achi acho?', u'ʌtʃɪ ʌtʃʊ?'), ('', ''), ('achi acho', u'ʌtʃɪ ʌtʃʊ ')])]) 63 + def test_preserve_empty_lines(backend, empty_lines, punctuation, prepend_text, text, expected): 64 + language = 'cree' if backend == 'segments' else 'en-us' 65 + 66 + @@ -278,11 +254,7 @@ def test_preserve_empty_lines(backend, empty_lines, punctuation, prepend_text, t 67 + ('segments', False, False, [''], []), 68 + ('segments', False, True, [''], []), 69 + ('segments', True, False, [''], ['']), 70 + - ('segments', True, True, [''], ['']), 71 + - ('festival', False, False, [''], []), 72 + - ('festival', False, True, [''], []), 73 + - ('festival', True, False, [''], ['']), 74 + - ('festival', True, True, [''], [''])]) 75 + + ('segments', True, True, [''], [''])]) 76 + def test_empty_input(backend, empty_lines, punctuation, text, expected): 77 + language = 'cree' if backend == 'segments' else 'en-us' 78 + 79 + diff --git a/test/test_punctuation.py b/test/test_punctuation.py 80 + index b2206ac..62e31c1 100644 81 + --- a/test/test_punctuation.py 82 + +++ b/test/test_punctuation.py 83 + @@ -28,9 +28,6 @@ ESPEAK_150 = (EspeakBackend.version() >= (1, 50)) 84 + # True if we are using espeak>=1.49.3 85 + ESPEAK_143 = (EspeakBackend.version() >= (1, 49, 3)) 86 + 87 + -# True if we are using festival>=2.5 88 + -FESTIVAL_25 = (FestivalBackend.version() >= (2, 5)) 89 + - 90 + 91 + @pytest.mark.parametrize( 92 + 'inp, out', [ 93 + @@ -179,9 +176,7 @@ def test_issue_54(text): 94 + ('espeak', 'default', ['! ?', 'hey!'], ['! ?', 'heɪ!']), 95 + ('espeak', '!', ['! ?', 'hey!'], ['! ', 'heɪ!']), 96 + ('segments', 'default', ['! ?', 'hey!'], ['! ?', 'heːj!']), 97 + - ('segments', '!', ['! ?', 'hey!'], ValueError), 98 + - ('festival', 'default', ['! ?', 'hey!'], ['! ?', 'hhey!']), 99 + - ('festival', '!', ['! ?', 'hey!'], ['! ', 'hhey!'])]) 100 + + ('segments', '!', ['! ?', 'hey!'], ValueError)]) 101 + def test_issue55(backend, marks, text, expected): 102 + if marks == 'default': 103 + marks = Punctuation.default_marks()