diff --git a/bypy/linux/__main__.py b/bypy/linux/__main__.py index bf287f9d63..70faff1fad 100644 --- a/bypy/linux/__main__.py +++ b/bypy/linux/__main__.py @@ -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) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index f94c84e049..4eda273a03 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -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