From 9b0065deb83f942096f3b09ea11badbcd13471f7 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Wed, 30 Mar 2022 14:45:12 -0400 Subject: [PATCH] Adjust shell scripts to use root of repo --- mimic3-http/install.sh => install.sh | 11 +++++++-- mimic3-http/run.sh | 5 ++-- mimic3-tts/download.sh | 5 ++-- mimic3-tts/install.sh | 34 ---------------------------- mimic3-tts/run.sh | 5 ++-- mimic3-tts/setup.py | 13 ++++++++++- 6 files changed, 27 insertions(+), 46 deletions(-) rename mimic3-http/install.sh => install.sh (72%) delete mode 100755 mimic3-tts/install.sh diff --git a/mimic3-http/install.sh b/install.sh similarity index 72% rename from mimic3-http/install.sh rename to install.sh index 19284e4..0ecd490 100755 --- a/mimic3-http/install.sh +++ b/install.sh @@ -26,8 +26,15 @@ echo 'Installing Python dependencies' pip3 ${PIP_INSTALL} --upgrade pip pip3 ${PIP_INSTALL} --upgrade wheel setuptools -find "${this_dir}" -name 'requirements*.txt' -type f -print0 | \ - xargs -0 -n1 pip3 ${PIP_INSTALL} -r +# Install Mimic 3 +pip3 ${PIP_INSTALL} -e "${this_dir}/opentts-abc" + +# Include support for languages besides English +pushd "${this_dir}/mimic3-tts" 2>/dev/null +pip3 ${PIP_INSTALL} -e '.[de,fr,it,nl,ru,sw]' +popd 2>/dev/null + +pip3 ${PIP_INSTALL} -e "${this_dir}/mimic3-http" # ----------------------------------------------------------------------------- diff --git a/mimic3-http/run.sh b/mimic3-http/run.sh index 9f59531..a7e430b 100755 --- a/mimic3-http/run.sh +++ b/mimic3-http/run.sh @@ -6,15 +6,14 @@ this_dir="$( cd "$( dirname "$0" )" && pwd )" # Kebab to snake case module_name="$(basename "${this_dir}" | sed -e 's/-/_/g')" -src_dir="${this_dir}/${module_name}" +base_dir="$(realpath "${this_dir}/..")" # Path to virtual environment -: "${venv:=${this_dir}/.venv}" +: "${venv:=${base_dir}/.venv}" if [ -d "${venv}" ]; then # Activate virtual environment if available source "${venv}/bin/activate" fi -export PYTHONPATH="${this_dir}" python3 -m "${module_name}" "$@" diff --git a/mimic3-tts/download.sh b/mimic3-tts/download.sh index 94d5025..b12e0bc 100755 --- a/mimic3-tts/download.sh +++ b/mimic3-tts/download.sh @@ -6,15 +6,14 @@ this_dir="$( cd "$( dirname "$0" )" && pwd )" # Kebab to snake case module_name="$(basename "${this_dir}" | sed -e 's/-/_/g')" -src_dir="${this_dir}/${module_name}" +base_dir="$(realpath "${this_dir}/..")" # Path to virtual environment -: "${venv:=${this_dir}/.venv}" +: "${venv:=${base_dir}/.venv}" if [ -d "${venv}" ]; then # Activate virtual environment if available source "${venv}/bin/activate" fi -export PYTHONPATH="${this_dir}" python3 -m "${module_name}.download" "$@" diff --git a/mimic3-tts/install.sh b/mimic3-tts/install.sh deleted file mode 100755 index 19284e4..0000000 --- a/mimic3-tts/install.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail - -# Directory of *this* script -this_dir="$( cd "$( dirname "$0" )" && pwd )" - -# Path to virtual environment -: "${venv:=${this_dir}/.venv}" - -# Python binary to use -: "${PYTHON=python3}" - -# pip install command -: "${PIP_INSTALL=install}" - -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 ${PIP_INSTALL} --upgrade pip -pip3 ${PIP_INSTALL} --upgrade wheel setuptools - -find "${this_dir}" -name 'requirements*.txt' -type f -print0 | \ - xargs -0 -n1 pip3 ${PIP_INSTALL} -r - -# ----------------------------------------------------------------------------- - -echo "OK" diff --git a/mimic3-tts/run.sh b/mimic3-tts/run.sh index 9f59531..a7e430b 100755 --- a/mimic3-tts/run.sh +++ b/mimic3-tts/run.sh @@ -6,15 +6,14 @@ this_dir="$( cd "$( dirname "$0" )" && pwd )" # Kebab to snake case module_name="$(basename "${this_dir}" | sed -e 's/-/_/g')" -src_dir="${this_dir}/${module_name}" +base_dir="$(realpath "${this_dir}/..")" # Path to virtual environment -: "${venv:=${this_dir}/.venv}" +: "${venv:=${base_dir}/.venv}" if [ -d "${venv}" ]; then # Activate virtual environment if available source "${venv}/bin/activate" fi -export PYTHONPATH="${this_dir}" python3 -m "${module_name}" "$@" diff --git a/mimic3-tts/setup.py b/mimic3-tts/setup.py index ddefcc9..c478920 100644 --- a/mimic3-tts/setup.py +++ b/mimic3-tts/setup.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # +from collections import defaultdict from pathlib import Path import setuptools @@ -59,6 +60,16 @@ for lang in [ ]: extras[f"gruut[{lang}]"] = [lang] +# Add "all" tag +for tags in extras.values(): + tags.append("all") + +# Invert for setup +extras_require = defaultdict(list) +for dep, tags in extras.items(): + for tag in tags: + extras_require[tag].append(dep) + # ----------------------------------------------------------------------------- setup( @@ -72,7 +83,7 @@ setup( packages=setuptools.find_packages(), package_data={"mimic3_tts": ["VERSION", "py.typed"]}, install_requires=requirements, - extras_require={':python_version<"3.9"': ["importlib_resources"], **extras}, + extras_require={':python_version<"3.9"': ["importlib_resources"], **extras_require}, entry_points={"console_scripts": ["mimic3 = mimic3_cli.__main__:main"]}, classifiers=[ "Development Status :: 3 - Alpha",