Small refactor of translation scripts

The modulename parameter for setup_projects are not needed anymore,
their usage has been removed with retirement of mitaka. Remove these
parameter.

Call setup_project only once per project and not for both python and
django setup. Also, move the zanata pull out to not have to create a
lock.

Change-Id: Iaf58a6882527eee3ce6528b516fe0f24f51cd976
This commit is contained in:
Andreas Jaeger 2017-12-19 13:10:35 +01:00
parent f86fd674c4
commit 235d97b627
3 changed files with 14 additions and 13 deletions

View File

@ -129,12 +129,10 @@ function setup_nodeenv {
}
# Setup a project for Zanata. This is used by both Python and Django projects.
# syntax: setup_project <project> <zanata_version> <modulename> [<modulename> ...]
# syntax: setup_project <project> <zanata_version>
function setup_project {
local project=$1
local version=$2
shift 2
# All argument(s) contain module names now.
# Exclude all dot-files, particuarly for things such such as .tox
# and .venv

View File

@ -157,6 +157,17 @@ function propose_python_django {
}
# Handle either python or django proposals
function handle_python_django_project {
local project=$1
setup_project "$project" "$ZANATA_VERSION"
pull_from_zanata "$project"
handle_python_django $project python
handle_python_django $project django
}
# Handle either python or django proposals
function handle_python_django {
local project=$1
@ -166,15 +177,9 @@ function handle_python_django {
module_names=$(get_modulename $project $kind)
if [ -n "$module_names" ]; then
setup_project "$project" "$ZANATA_VERSION" $module_names
if [[ "$kind" == "django" ]] ; then
install_horizon
fi
# Pull updated translations from Zanata only the first time
if [ ! -f .zanata-pull ] ; then
touch .zanata-pull
pull_from_zanata "$project"
fi
propose_releasenotes "$ZANATA_VERSION"
for modulename in $module_names; do
# Note that we need to generate the pot files so that we
@ -312,8 +317,7 @@ case "$PROJECT" in
;;
*)
# Common setup for python and django repositories
handle_python_django $PROJECT python
handle_python_django $PROJECT django
handle_python_django_project $PROJECT
;;
esac

View File

@ -88,10 +88,10 @@ case "$PROJECT" in
;;
*)
# Common setup for python and django repositories
setup_project "$PROJECT" "$ZANATA_VERSION"
# ---- Python projects ----
module_names=$(get_modulename $PROJECT python)
if [ -n "$module_names" ]; then
setup_project "$PROJECT" "$ZANATA_VERSION" $module_names
if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
extract_messages_releasenotes
ALL_MODULES="releasenotes $ALL_MODULES"
@ -105,7 +105,6 @@ case "$PROJECT" in
# ---- Django projects ----
module_names=$(get_modulename $PROJECT django)
if [ -n "$module_names" ]; then
setup_project "$PROJECT" "$ZANATA_VERSION" $module_names
install_horizon
if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
extract_messages_releasenotes