From: Frank Brehm Date: Tue, 23 Jun 2020 15:26:13 +0000 (+0200) Subject: Moving executable stuff into bin/ X-Git-Tag: 2.1.2^2~9^2~29 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=3c241bf16c60168577a9d542315e9d6ea207dd46;p=pixelpark%2Fcreate-vmware-tpl.git Moving executable stuff into bin/ --- diff --git a/bin/compile-xlate-msgs.sh b/bin/compile-xlate-msgs.sh new file mode 100755 index 0000000..c139fca --- /dev/null +++ b/bin/compile-xlate-msgs.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e +set -u + +this_script=$( readlink -f "$0" ) +cur_dir=$( pwd ) + +base_dir=$( dirname "$( dirname "${this_script}" )" ) +cd "${base_dir}" + +locale_dir=locale +locale_domain="create_vm_template" + +if [[ ! -d "${locale_dir}" ]] ; then + echo "Localisation directory '${cur_dir}/${locale_dir}' not found." >&2 + exit 3 +fi + +pybabel compile --domain "${locale_domain}" \ + --directory "${locale_dir}" \ + --statistics + diff --git a/bin/update-env.sh b/bin/update-env.sh new file mode 100755 index 0000000..dead18b --- /dev/null +++ b/bin/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 diff --git a/bin/xtract-xlate-msgs.sh b/bin/xtract-xlate-msgs.sh new file mode 100755 index 0000000..0ada1fc --- /dev/null +++ b/bin/xtract-xlate-msgs.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +set -e +set -u + +this_script=$( readlink -f "$0" ) +cur_dir=$( pwd ) + +base_dir=$( dirname "$( dirname "${this_script}" )" ) +cd ${base_dir} + +locale_dir=locale +locale_domain="create_vm_template" +pot_file="${locale_dir}/${locale_domain}.pot" +po_with=99 +my_address="${DEBEMAIL:-frank.brehm@pixelpark.com}" + +pkg_version=$( cat lib/cr_vmware_tpl/__init__.py | \ + grep '^[ ]*__version__' | \ + sed -e 's/[ ]*//g' | \ + awk -F= '{print $2}' | \ + sed -e "s/^'//" -e "s/'\$//" ) + +mkdir -pv "${locale_dir}" + +pybabel extract lib/cr_vmware_tpl \ + -o "${pot_file}" \ + -F babel.ini \ + --width=${po_with} \ + --sort-by-file \ + --msgid-bugs-address="${my_address}" \ + --copyright-holder="Frank Brehm, Pixelpark GmbH, Berlin" \ + --project="${locale_domain}" \ + --version="${pkg_version}" + +sed -i -e "s/FIRST AUTHOR/Frank Brehm/g" -e "s//<${my_address}>/g" "${pot_file}" + +for lang in de_DE en_US ; do + if [[ ! -f "${locale_dir}/${lang}/LC_MESSAGES/${locale_domain}.po" ]] ; then + pybabel init --domain "${locale_domain}" \ + --input-file "${pot_file}" \ + --output-dir "${locale_dir}" \ + --locale "${lang}" \ + --width ${po_with} + else + pybabel update --domain "${locale_domain}" \ + --input-file "${pot_file}" \ + --output-dir "${locale_dir}" \ + --locale "${lang}" \ + --width ${po_with} \ + --update-header-comment + fi + # --ignore-obsolete \ + + sed -i -e "s/^\"Project-Id-Version:.*/\"Project-Id-Version: ${locale_domain} ${pkg_version}\\\\n\"/" "${po_file}" + +done diff --git a/compile-xlate-msgs.sh b/compile-xlate-msgs.sh deleted file mode 100755 index 5aafcb8..0000000 --- a/compile-xlate-msgs.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e -set -u - -base_dir=$( dirname $0 ) -cd ${base_dir} - -locale_dir=locale -locale_domain="create_vm_template" -pot_file="${locale_dir}/${locale_domain}.pot" -po_with=99 -my_address="${DEBEMAIL:-frank.brehm@pixelpark.com}" - -pybabel compile --domain "${locale_domain}" \ - --directory "${locale_dir}" \ - --statistics - diff --git a/update-env.sh b/update-env.sh deleted file mode 100755 index 97550a1..0000000 --- a/update-env.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/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 diff --git a/xtract-xlate-msgs.sh b/xtract-xlate-msgs.sh deleted file mode 100755 index 6df9d2b..0000000 --- a/xtract-xlate-msgs.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -set -e -set -u - -base_dir=$( dirname $0 ) -cd ${base_dir} - -locale_dir=locale -locale_domain="create_vm_template" -pot_file="${locale_dir}/${locale_domain}.pot" -po_with=99 -my_address="${DEBEMAIL:-frank.brehm@pixelpark.com}" - -pkg_version=$( cat lib/cr_vmware_tpl/__init__.py | \ - grep '^[ ]*__version__' | \ - sed -e 's/[ ]*//g' | \ - awk -F= '{print $2}' | \ - sed -e "s/^'//" -e "s/'\$//" ) - -mkdir -pv "${locale_dir}" - -pybabel extract lib/cr_vmware_tpl \ - -o "${pot_file}" \ - -F babel.ini \ - --width=${po_with} \ - --sort-by-file \ - --msgid-bugs-address="${my_address}" \ - --copyright-holder="Frank Brehm, Pixelpark GmbH, Berlin" \ - --project="${locale_domain}" \ - --version="${pkg_version}" - -sed -i -e "s/FIRST AUTHOR/Frank Brehm/g" -e "s//<${my_address}>/g" "${pot_file}" - -for lang in de_DE en_US ; do - if [[ ! -f "${locale_dir}/${lang}/LC_MESSAGES/${locale_domain}.po" ]] ; then - pybabel init --domain "${locale_domain}" \ - --input-file "${pot_file}" \ - --output-dir "${locale_dir}" \ - --locale "${lang}" \ - --width ${po_with} - else - pybabel update --domain "${locale_domain}" \ - --input-file "${pot_file}" \ - --output-dir "${locale_dir}" \ - --locale "${lang}" \ - --width ${po_with} \ - --update-header-comment - fi - # --ignore-obsolete \ -done