Include the piper binaries in the Linux binary build

This commit is contained in:
Kovid Goyal 2024-09-03 21:34:08 +05:30
parent 7fbc1d7184
commit 25620a7886
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 4 deletions

View File

@ -107,6 +107,11 @@ def import_site_packages(srcdir, dest):
shutil.copytree(f, j(dest, x), ignore=ignore_in_lib)
def copy_piper(env):
print('Copying piper...')
shutil.copytree(os.path.join(PREFIX, 'piper'), os.path.join(env.bin_dir, 'piper'))
def copy_libs(env):
print('Copying libs...')
@ -252,7 +257,7 @@ def strip_files(files, argv_max=(256 * 1024)):
def strip_binaries(env):
files = {j(env.bin_dir, x) for x in os.listdir(env.bin_dir)} | {
files = {j(env.bin_dir, x) for x in os.listdir(env.bin_dir) if x != 'piper'} | {
x for x in {
j(os.path.dirname(env.bin_dir), x) for x in os.listdir(env.bin_dir)} if os.path.exists(x)}
for x in walk(env.lib_dir):
@ -304,6 +309,7 @@ def main():
env = Env()
copy_libs(env)
copy_python(env, ext_dir)
copy_piper(env)
build_launchers(env)
if not args.skip_tests:
run_tests(j(env.base, 'calibre-debug'), env.base)

View File

@ -488,7 +488,7 @@ def get_umask():
return mask
# call this at startup as it changed process global state, which doesn't work
# call this at startup as it changes process global state, which doesn't work
# with multi-threading. It's absurd there is no way to safely read the current
# umask of a process.
get_umask()
@ -511,8 +511,7 @@ def bundled_binaries_dir() -> str:
def piper_cmdline() -> tuple[str, ...]:
ext = '.exe' if iswindows else ''
if bbd := bundled_binaries_dir():
# TODO: Add path to espeak-ng-data with --
return (os.path.join(bbd, 'piper' + ext),)
return (os.path.join(bbd, 'piper', 'piper' + ext),)
if pd := os.environ.get('PIPER_TTS_DIR'):
return (os.path.join(pd, 'piper' + ext),)
import shutil