From 96a6b67fc04d9ade3f71bfd2de45c29c164bde8c Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 6 Feb 2019 16:38:38 +0100 Subject: [PATCH] Adding update-env.sh, updating python_fb_tools and requirements.txt --- python_fb_tools | 2 +- requirements.txt | 2 -- update-env.sh | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100755 update-env.sh diff --git a/python_fb_tools b/python_fb_tools index 89a0d8b..2919e48 160000 --- a/python_fb_tools +++ b/python_fb_tools @@ -1 +1 @@ -Subproject commit 89a0d8b45c52afab975f3dee7c291e4a8199e603 +Subproject commit 2919e48b0e42b8aa092e5956dc325f0e881a9369 diff --git a/requirements.txt b/requirements.txt index 5556836..e0188a9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,3 @@ requests six pytz paramiko -flake8 -pathlib diff --git a/update-env.sh b/update-env.sh new file mode 100755 index 0000000..4e2b04a --- /dev/null +++ b/update-env.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +base_dir=$( dirname $0 ) +cd ${base_dir} +base_dir=$( readlink -f . ) + +declare -a VALID_PY_VERSIONS=("3.8" "3.7" "3.6" "3.5") + +echo "Preparing virtual environment ..." +echo +if [[ ! -f venv/bin/activate ]] ; then + found="n" + for py_version in "${VALID_PY_VERSIONS[@]}" ; do + PYTHON="python${py_version}" + if type -t ${PYTHON} >/dev/null ; then + found="y" + echo + echo "Found ${PYTHON}." + echo + virtualenv --python=${PYTHON} venv + break + fi + done + if [[ "${found}" == "n" ]] ; then + echo >&2 + echo "Did not found a usable Python version." >&2 + echo "Usable Python versions are: ${VALID_PY_VERSIONS[*]}" >&2 + echo >&2 + exit 5 + fi +fi + +echo +echo "---------------------------------------------------" +echo "Updating Git submodule python_fb_tools ..." +echo "git init ..." +echo +git submodule init +echo +echo "--------------" +echo "git update ..." +echo +git submodule update --init --recursive python_fb_tools + +. venv/bin/activate || exit 5 + +echo "---------------------------------------------------" +echo "Installing and/or upgrading necessary modules ..." +echo +echo "From python_fb_tools ..." +echo +pip install --upgrade --upgrade-strategy eager --requirement python_fb_tools/requirements.txt +echo +echo "From own ..." +echo +pip install --upgrade --upgrade-strategy eager --requirement requirements.txt +echo +echo "---------------------------------------------------" +echo "Installed modules:" +echo +pip list --format columns + +#if [[ -x compile-xlate-msgs.sh ]]; then +# echo +# echo "--------------" +# echo "Updating i18n files in ${base_dir} ..." +# echo +# ./compile-xlate-msgs.sh +#fi + +cd python_fb_tools +if [[ -x compile-xlate-msgs.sh ]]; then + echo + echo "--------------" + echo "Updating i18n files in python_fb_tools ..." + echo + ./compile-xlate-msgs.sh +fi +cd .. + +echo +echo "-------" +echo "Fertig." +echo + +# vim: ts=4 -- 2.39.5