From d802a53161ec9bbf6cea1837ee023a32ccc9be5e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 4 Mar 2019 11:34:30 +1000 Subject: [PATCH] explicitly import _ in forms/ --- tools/build_ui.sh | 7 ++++--- tools/lint.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/build_ui.sh b/tools/build_ui.sh index 85feddb24..52a8b46b0 100755 --- a/tools/build_ui.sh +++ b/tools/build_ui.sh @@ -27,10 +27,11 @@ do echo "from . import $base" >> $temp if [ $i -nt $py ]; then echo " * "$py - pyuic5 --from-imports $i -o $py + pyuic5 --from-imports $i -o $py.tmp # munge the output to use gettext - perl -pi.bak -e 's/(QtGui\.QApplication\.)?_?translate\(".*?", /_(/; s/, None.*/))/' $py - rm $py.bak + cat $py.tmp | sed "/WARNING/ a\\ +from anki.lang import _" | perl -p -e 's/(QtGui\.QApplication\.)?_?translate\(".*?", /_(/; s/, None.*/))/' > $py + rm $py.tmp fi done echo "]" >> $init diff --git a/tools/lint.sh b/tools/lint.sh index bb8cf307a..320832bb7 100755 --- a/tools/lint.sh +++ b/tools/lint.sh @@ -1,4 +1,4 @@ #!/bin/bash TOOLS="$(cd "`dirname "$0"`"; pwd)" -pylint -E -j 0 -f colorized --disable=E0602 $TOOLS/../anki $TOOLS/../aqt +pylint -E -j 0 -f colorized $TOOLS/../anki $TOOLS/../aqt