From cf5ca10c1a18bd8245d8953a79e139d8b6a5bb27 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 2 Feb 2016 10:43:17 +0100 Subject: [PATCH] Ignore empty django files We do not need to handle empty django*pot files. Check in extract_messages_django whether files are empty and remove them. This is the same logic that is done in extract_messages. Story: 2000452 Change-Id: I8e36609d7286dc90393f02b0e7bf229a2e1f4420 --- jenkins/scripts/common_translation_update.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jenkins/scripts/common_translation_update.sh b/jenkins/scripts/common_translation_update.sh index cbbd863a4f..cc1def5a0f 100644 --- a/jenkins/scripts/common_translation_update.sh +++ b/jenkins/scripts/common_translation_update.sh @@ -361,9 +361,17 @@ function extract_messages_django { for DOMAIN in djangojs django ; do if [ -f babel-${DOMAIN}.cfg ]; then mkdir -p ${modulename}/locale - touch ${modulename}/locale/${DOMAIN}.pot + POT=${modulename}/locale/${DOMAIN}.pot + touch ${POT} $VENV/bin/pybabel extract -F babel-${DOMAIN}.cfg \ - -o ${modulename}/locale/${DOMAIN}.pot $KEYWORDS ${modulename} + -o ${POT} $KEYWORDS ${modulename} + # We don't need to add or send around empty source files. + trans=$(msgfmt --statistics -o /dev/null ${POT} 2>&1) + if [ "$trans" = "0 translated messages." ] ; then + rm $POT + # Remove file from git if it's under version control. + git rm --ignore-unmatch $POT + fi fi done rm -rf $VENV $root