mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Get new piper module working on macOS
This commit is contained in:
parent
9021419440
commit
650aeee96d
@ -22,7 +22,6 @@ from itertools import repeat
|
||||
from bypy.constants import OUTPUT_DIR, PREFIX, PYTHON, python_major_minor_version
|
||||
from bypy.constants import SRC as CALIBRE_DIR
|
||||
from bypy.freeze import extract_extension_modules, fix_pycryptodome, freeze_python, is_package_dir, path_to_freeze_dir
|
||||
from bypy.pkgs.piper import copy_piper_dir
|
||||
from bypy.utils import current_dir, get_arches_in_binary, mkdtemp, py_compile, timeit, walk
|
||||
|
||||
abspath, join, basename, dirname = os.path.abspath, os.path.join, os.path.basename, os.path.dirname
|
||||
@ -542,7 +541,7 @@ class Freeze:
|
||||
'icudata.73', 'icui18n.73', 'icuio.73', 'icuuc.73', 'hyphen.0', 'uchardet.0',
|
||||
'stemmer.0', 'xslt.1', 'exslt.0', 'xml2.2', 'z.1', 'unrar', 'lzma.5',
|
||||
'brotlicommon.1', 'brotlidec.1', 'brotlienc.1', 'zstd.1', 'jbig.2.1', 'tiff.6',
|
||||
'crypto.3', 'ssl.3', 'iconv.2', # 'ltdl.7'
|
||||
'crypto.3', 'ssl.3', 'iconv.2', 'espeak-ng.1', 'onnxruntime.1.22.1', # 'ltdl.7'
|
||||
):
|
||||
x = 'lib%s.dylib' % x
|
||||
src = join(PREFIX, 'lib', x)
|
||||
@ -557,8 +556,8 @@ class Freeze:
|
||||
dylib = join(dest, dylib)
|
||||
self.set_id(dylib, self.FID + '/' + x + '/' + os.path.basename(dylib))
|
||||
self.fix_dependencies_in_lib(dylib)
|
||||
# Piper TTS
|
||||
copy_piper_dir(PREFIX, self.frameworks_dir)
|
||||
# espeak voices used for piper phonemization
|
||||
shutil.copytree(join(PREFIX, 'share', 'espeak-ng-data'), join(self.resources_dir, 'espeak-ng-data'))
|
||||
|
||||
@flush
|
||||
def add_site_packages(self):
|
||||
|
@ -200,6 +200,9 @@ elif ismacos:
|
||||
openssl_lib_dirs = [os.path.join(SSL, 'lib')]
|
||||
if os.path.exists(os.path.join(sw_bin_dir, 'cmake')):
|
||||
CMAKE = os.path.join(sw_bin_dir, 'cmake')
|
||||
piper_inc_dirs = [sw_inc_dir, os.path.join(sw_inc_dir, 'onnxruntime')]
|
||||
piper_lib_dirs = [sw_lib_dir]
|
||||
piper_libs = ['espeak-ng', 'onnxruntime']
|
||||
else:
|
||||
freetype_inc_dirs = pkgconfig_include_dirs('freetype2', 'FT_INC_DIR',
|
||||
'/usr/include/freetype2')
|
||||
|
@ -12,7 +12,7 @@ from threading import Lock, Thread
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
import calibre_extensions.piper as piper
|
||||
from calibre.constants import iswindows
|
||||
from calibre.constants import ismacos, iswindows
|
||||
|
||||
DEFAULT_LENGTH_SCALE = 1.0
|
||||
DEFAULT_NOISE_SCALE = 0.667
|
||||
@ -64,6 +64,8 @@ def espeak_data_dir() -> str:
|
||||
return ''
|
||||
if iswindows:
|
||||
return os.path.join(os.path.dirname(sys.executables_location), 'share', 'espeak-ng-data')
|
||||
if ismacos:
|
||||
return os.path.join(os.path.dirname(sys.frameworks_dir), 'Resources', 'espeak-ng-data')
|
||||
return os.path.join(sys.executables_location, 'share', 'espeak-ng-data')
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user