A fast, local neural text to speech system
Use python scripts instead of bash
Michael Hansen8b1a90099adb
diff --git a/src/python_run/scripts/format b/src/python_run/scripts/formatnew file mode 100755index 0000000..b181b3b--- /dev/null+++ b/src/python_run/scripts/format@@ -0,0 +1,13 @@+#!/usr/bin/env python3+import subprocess+import venv+from pathlib import Path++_DIR = Path(__file__).parent+_PROGRAM_DIR = _DIR.parent+_VENV_DIR = _PROGRAM_DIR / ".venv"+_MODULE_DIR = _PROGRAM_DIR / "piper"++context = venv.EnvBuilder().ensure_directories(_VENV_DIR)+subprocess.check_call([context.env_exe, "-m", "black", str(_MODULE_DIR)])+subprocess.check_call([context.env_exe, "-m", "isort", str(_MODULE_DIR)])diff --git a/src/python_run/scripts/lint b/src/python_run/scripts/lintnew file mode 100755index 0000000..a96e46b--- /dev/null+++ b/src/python_run/scripts/lint@@ -0,0 +1,16 @@+#!/usr/bin/env python3+import subprocess+import venv+from pathlib import Path++_DIR = Path(__file__).parent+_PROGRAM_DIR = _DIR.parent+_VENV_DIR = _PROGRAM_DIR / ".venv"+_MODULE_DIR = _PROGRAM_DIR / "piper"++context = venv.EnvBuilder().ensure_directories(_VENV_DIR)+subprocess.check_call([context.env_exe, "-m", "black", str(_MODULE_DIR), "--check"])+subprocess.check_call([context.env_exe, "-m", "isort", str(_MODULE_DIR), "--check"])+subprocess.check_call([context.env_exe, "-m", "flake8", str(_MODULE_DIR)])+subprocess.check_call([context.env_exe, "-m", "pylint", str(_MODULE_DIR)])+subprocess.check_call([context.env_exe, "-m", "mypy", str(_MODULE_DIR)])diff --git a/src/python_run/scripts/setup b/src/python_run/scripts/setupnew file mode 100755index 0000000..ec98a5e--- /dev/null+++ b/src/python_run/scripts/setup@@ -0,0 +1,31 @@+#!/usr/bin/env python3+import subprocess+import venv+from pathlib import Path++_DIR = Path(__file__).parent+_PROGRAM_DIR = _DIR.parent+_VENV_DIR = _PROGRAM_DIR / ".venv"+++# Create virtual environment+builder = venv.EnvBuilder(with_pip=True)+context = builder.ensure_directories(_VENV_DIR)+builder.create(_VENV_DIR)++# Upgrade dependencies+pip = [context.env_exe, "-m", "pip"]+subprocess.check_call(pip + ["install", "--upgrade", "pip"])+subprocess.check_call(pip + ["install", "--upgrade", "setuptools", "wheel"])++# Install requirements+subprocess.check_call(+ pip+ + [+ "install",+ "-f",+ "https://synesthesiam.github.io/prebuilt-apps/",+ "-r",+ str(_PROGRAM_DIR / "requirements.txt"),+ ]+)diff --git a/src/python_run/scripts/setup.sh b/src/python_run/scripts/setup.shdeleted file mode 100755index 32a8c89..0000000--- a/src/python_run/scripts/setup.sh+++ /dev/null@@ -1,33 +0,0 @@-#!/usr/bin/env bash-set -eo pipefail--# Directory of *this* script-this_dir="$( cd "$( dirname "$0" )" && pwd )"--# Base directory of repo-base_dir="$(realpath "${this_dir}/..")"--# Path to virtual environment-: "${venv:=${base_dir}/.venv}"--# Python binary to use-: "${PYTHON=python3}"--python_version="$(${PYTHON} --version)"--# Create virtual environment-echo "Creating virtual environment at ${venv} (${python_version})"-rm -rf "${venv}"-"${PYTHON}" -m venv "${venv}"-source "${venv}/bin/activate"--# Install Python dependencies-echo 'Installing Python dependencies'-pip3 install --upgrade pip-pip3 install --upgrade wheel setuptools--pip3 install -r "${base_dir}/requirements.txt"--# -------------------------------------------------------------------------------echo "OK"