From: Bruno Haible Date: Sun, 2 Jan 2022 14:39:59 +0000 (+0100) Subject: Fix lang-python-* test failures with Python 3.8. X-Git-Tag: v0.21.1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42bb27463127242c9adea99b2dd47a0e8c958478;p=thirdparty%2Fgettext.git Fix lang-python-* test failures with Python 3.8. * gettext-tools/tests/lang-python-1: Use syntax that works also with Python 3. * gettext-tools/tests/lang-python-2: Likewise. --- diff --git a/gettext-tools/tests/lang-python-1 b/gettext-tools/tests/lang-python-1 index 4e5acd9cc..41264bfaa 100755 --- a/gettext-tools/tests/lang-python-1 +++ b/gettext-tools/tests/lang-python-1 @@ -13,9 +13,9 @@ import gettext gettext.textdomain('prog') gettext.bindtextdomain('prog', '.') -print gettext.gettext("'Your command, please?', asked the waiter.") -print gettext.gettext("%(oldCurrency)s is replaced by %(newCurrency)s.") \ - % { 'oldCurrency': "FF", 'newCurrency' : "EUR" } +print(gettext.gettext("'Your command, please?', asked the waiter.")) +print(gettext.gettext("%(oldCurrency)s is replaced by %(newCurrency)s.") \ + % { 'oldCurrency': "FF", 'newCurrency' : "EUR" }) EOF : ${XGETTEXT=xgettext} @@ -65,7 +65,7 @@ ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po # Test for presence of python version 2.0 or newer. (python -V) >/dev/null 2>/dev/null \ || { echo "Skipping test: python not found"; Exit 77; } -case `python -c 'import sys; print sys.hexversion >= 0x20000F0'` in +case `python -c 'import sys; print(sys.hexversion >= 0x20000F0)'` in 1 | True) ;; *) echo "Skipping test: python version too old"; Exit 77;; esac diff --git a/gettext-tools/tests/lang-python-2 b/gettext-tools/tests/lang-python-2 index c1af9275a..939400395 100755 --- a/gettext-tools/tests/lang-python-2 +++ b/gettext-tools/tests/lang-python-2 @@ -17,11 +17,11 @@ n = int(sys.argv[1]) gettext.textdomain('prog') gettext.bindtextdomain('prog', '.') -print gettext.gettext("'Your command, please?', asked the waiter.") -print gettext.ngettext("a piece of cake","%(count)d pieces of cake",n) \ - % { 'count': n } -print gettext.gettext("%(oldCurrency)s is replaced by %(newCurrency)s.") \ - % { 'oldCurrency': "FF", 'newCurrency' : "EUR" } +print(gettext.gettext("'Your command, please?', asked the waiter.")) +print(gettext.ngettext("a piece of cake","%(count)d pieces of cake",n) \ + % { 'count': n }) +print(gettext.gettext("%(oldCurrency)s is replaced by %(newCurrency)s.") \ + % { 'oldCurrency': "FF", 'newCurrency' : "EUR" }) EOF : ${XGETTEXT=xgettext} @@ -84,7 +84,7 @@ ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po # Test for presence of python version 2.3 or newer. (python -V) >/dev/null 2>/dev/null \ || { echo "Skipping test: python not found"; Exit 77; } -case `python -c 'import sys; print sys.hexversion >= 0x20300F0'` in +case `python -c 'import sys; print(sys.hexversion >= 0x20300F0)'` in 1 | True) ;; *) echo "Skipping test: python version too old"; Exit 77;; esac