From: David Shea dshea@redhat.com
This ensures that unsuitable strings do not end up in the POT file.
Using the xgettext_werror wrapper replaces the function of the gettext_warnings test. --- Makefile.am | 7 ++++++ po/Makevars | 3 +++ tests/Makefile.am | 2 -- tests/gettext_tests/gettext_warnings.sh | 44 --------------------------------- 4 files changed, 10 insertions(+), 46 deletions(-) delete mode 100755 tests/gettext_tests/gettext_warnings.sh
diff --git a/Makefile.am b/Makefile.am index 3e0ae5a..7920e6b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,11 @@ SUBDIRS = data docs dracut po pyanaconda scripts tests widgets utils
EXTRA_DIST = config.rpath COPYING .coveragerc
+# Include the "translatable" files from translation-canary for POT updates +# during distcheck +EXTRA_DIST += $(srcdir)/translation-canary/translatable/*.py \ + $(srcdir)/translation-canary/translatable/*.sh + # Files generated for gettext need to be included in the distribution EXTRA_DIST += $(srcdir)/anaconda.po $(srcdir)/anaconda.po: $(srcdir)/anaconda @@ -88,6 +93,7 @@ scratch-bumpver: po-empty fi ; \ ( cd $(srcdir) && scripts/makebumpver --skip-zanata $${opts} ) || exit 1 ; \ $(MAKE) -C po $(PACKAGE_NAME).pot-update + PYTHONPATH=$(srcdir)/translation-canary python3 -m translatable $(srcdir)/po/$(PACKAGE_NAME).pot
release: $(MAKE) dist && $(MAKE) tag && git checkout -- $(srcdir)/po/$(PACKAGE_NAME).pot @@ -113,6 +119,7 @@ bumpver: po-pull fi ; \ ( cd $(srcdir) && scripts/makebumpver $${opts} ) || exit 1 ; \ $(MAKE) -C po $(PACKAGE_NAME).pot-update && \ + PYTHONPATH=$(srcdir)/translation-canary python3 -m translatable $(srcdir)/po/$(PACKAGE_NAME).pot && \ zanata push $(ZANATA_PUSH_ARGS)
# Install all packages specified as BuildRequires in the Anaconda specfile diff --git a/po/Makevars b/po/Makevars index f52adbe..f6a96d1 100644 --- a/po/Makevars +++ b/po/Makevars @@ -7,6 +7,9 @@ DOMAIN = $(PACKAGE) subdir = po top_builddir = ..
+# Wrap xgettext in a script that fails on warnings +XGETTEXT = $(top_srcdir)/translation-canary/translatable/xgettext_werror.sh + # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_:1,2 --keyword=C_:1c,2 --keyword=CN_:1c,2 --keyword=CP_:1c,2,3 --from-code=UTF-8
diff --git a/tests/Makefile.am b/tests/Makefile.am index be2bdf0..6ea640d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,7 +46,6 @@ dist_check_SCRIPTS = $(srcdir)/glade/*.py \ cppcheck/runcppcheck.sh \ testenv.sh \ $(srcdir)/gettext_tests/*.py \ - gettext_tests/gettext_warnings.sh \ storage/run_storage_tests.py \ install/run_install_test.sh \ $(srcdir)/gui/*.ks \ @@ -60,7 +59,6 @@ TESTS = nosetests.sh \ pylint/runpylint.py \ cppcheck/runcppcheck.sh \ gettext_tests/click.py \ - gettext_tests/gettext_warnings.sh \ gettext_tests/gettext_potfiles.py \ gettext_tests/style_guide.py \ gettext_tests/contexts.py \ diff --git a/tests/gettext_tests/gettext_warnings.sh b/tests/gettext_tests/gettext_warnings.sh deleted file mode 100755 index 2974e32..0000000 --- a/tests/gettext_tests/gettext_warnings.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -e - -if [ -z "$top_srcdir" ]; then - top_srcdir="$(dirname "$0")/../.." - . "${top_srcdir}/tests/testenv.sh" -fi -podir="${top_builddir}/po" -POTFILES="${podir}/POTFILES" - -# Extract XGETTEXT_OPTIONS from po/Makevars -# Makevars is one of our files, so it's in $srcdir -XGETTEXT_OPTIONS="$(sed -n 's/^[[:space:]]*XGETTEXT_OPTIONS[[:space:]]*=[[:space:]]*(.*)/\1/p' \ - "${top_srcdir}/po/Makevars")" - -# Fail if POTFILES doesn't exist, since set -e doesn't catch this for some -# dumb reason that I'm sure has a long and storied history -if [ ! -f "${POTFILES}" ] ; then - echo "POTFILES does not exist" - exit 1 -fi - -status=0 -# For each file in POTFILES, run xgettext and look for warnings -while read -r potfile ; do - # Strip the spaces and trailing backslash - potfile="$(echo "$potfile" | sed 's/^[[:space:]]*([^[:space:]]*)[[:space:]]*\?$/\1/')" - - # $potfile is relative to the po/ directory, $test_potfile is - # relative to this script's working directory - test_potfile="${podir}/${potfile}" - - # If the file doesn't exist, try to make it - if [ ! -f "$test_potfile" ]; then - make -C "${podir}" "${potfile}" || exit 1 - fi - - xgettext_output="$(xgettext ${XGETTEXT_OPTIONS} -o /dev/null "$test_potfile" 2>&1)" || status=1 - if echo "$xgettext_output" | fgrep -q 'warning:' ; then - echo "$xgettext_output" - status=1 - fi -done < "$POTFILES" - -exit "$status"
anaconda-patches@lists.fedorahosted.org