summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build_adafruit_bins.sh77
-rw-r--r--tools/check_translations.py23
-rwxr-xr-xtools/mpy-tool.py2
3 files changed, 61 insertions, 41 deletions
diff --git a/tools/build_adafruit_bins.sh b/tools/build_adafruit_bins.sh
index 29ee35c6a..94c6a3646 100755
--- a/tools/build_adafruit_bins.sh
+++ b/tools/build_adafruit_bins.sh
@@ -16,22 +16,6 @@ else
boards=$TRAVIS_BOARD
fi
-for board in $boards; do
- if [ $board == "feather_huzzah" ]; then
- make $PARALLEL -C ports/esp8266 BOARD=feather_huzzah
- (( exit_status = exit_status || $? ))
- elif [ $board == "feather52832" ]; then
- make $PARALLEL -C ports/nrf BOARD=feather52832
- (( exit_status = exit_status || $? ))
- elif [ $board == "pca10056" ]; then
- make $PARALLEL -C ports/nrf BOARD=pca10056 SD=s140
- (( exit_status = exit_status || $? ))
- else
- make $PARALLEL -C ports/atmel-samd BOARD=$board
- (( exit_status = exit_status || $? ))
- fi
-done
-
version=`git describe --tags --exact-match`
if [ $? -ne 0 ]; then
version=`date +%Y%m%d`-`git rev-parse --short HEAD`
@@ -49,31 +33,44 @@ fi
for board in $boards; do
mkdir -p bin/$board/
extension=uf2
- if [ $board == "feather_huzzah" ]; then
- cp ports/esp8266/build/firmware-combined.bin bin/$board/adafruit-circuitpython-$board-$version.bin
- (( exit_status = exit_status || $? ))
- extension=bin
- elif [ $board == "feather52832" ]; then
- cp ports/nrf/build-$board-s132/firmware.bin bin/$board/adafruit-circuitpython-$board-$version.bin
- (( exit_status = exit_status || $? ))
- extension=bin
- elif [ $board == "pca10056" ]; then
- cp ports/nrf/build-$board-s140/firmware.bin bin/$board/adafruit-circuitpython-$board-$version.bin
- (( exit_status = exit_status || $? ))
- extension=bin
- else
- cp ports/atmel-samd/build-$board/firmware.bin bin/$board/adafruit-circuitpython-$board-$version.bin
+ for language_file in $(ls locale/*.po); do
+ language=$(basename -s .po $language_file)
+ echo "Building $board for $language"
+ if [ $board == "feather_huzzah" ]; then
+ make $PARALLEL -C ports/esp8266 TRANSLATION=$language BOARD=feather_huzzah
+ (( exit_status = exit_status || $? ))
+ temp_filename=ports/esp8266/build/firmware-combined.bin
+ extension=bin
+ elif [ $board == "feather52832" ]; then
+ make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather52832
+ (( exit_status = exit_status || $? ))
+ temp_filename=ports/nrf/build-$board-s132/firmware.bin
+ extension=bin
+ elif [ $board == "pca10056" ]; then
+ make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=pca10056 SD=s140
+ (( exit_status = exit_status || $? ))
+ temp_filename=ports/nrf/build-$board-s140/firmware.bin
+ extension=bin
+ else
+ time make $PARALLEL -C ports/atmel-samd TRANSLATION=$language BOARD=$board
+ (( exit_status = exit_status || $? ))
+ cp ports/atmel-samd/build-$board/firmware.bin bin/$board/adafruit-circuitpython-$board-$language-$version.bin
+ (( exit_status = exit_status || $? ))
+ temp_filename=ports/atmel-samd/build-$board/firmware.uf2
+ extension=uf2
+ fi
+ final_filename=bin/$board/adafruit-circuitpython-$board-$language-$version.$extension
+ cp $temp_filename $final_filename
(( exit_status = exit_status || $? ))
- cp ports/atmel-samd/build-$board/firmware.uf2 bin/$board/adafruit-circuitpython-$board-$version.uf2
- (( exit_status = exit_status || $? ))
- fi
- # Only upload to Rosie if its a pull request.
- if [ "$TRAVIS" == "true" ]; then
- for rosie in $ROSIE_SETUPS; do
- echo "Uploading to https://$rosie.ngrok.io/upload/$sha"
- curl -F "file=@bin/$board/adafruit-circuitpython-$board-$version.$extension" https://$rosie.ngrok.io/upload/$sha
- done
- fi
+ # Only upload to Rosie if its a pull request.
+ if [ "$TRAVIS" == "true" ]; then
+ for rosie in $ROSIE_SETUPS; do
+ echo "Uploading to https://$rosie.ngrok.io/upload/$sha"
+ curl -F "file=@$final_filename" https://$rosie.ngrok.io/upload/$sha
+ done
+ fi
+ echo
+ done
done
exit $exit_status
diff --git a/tools/check_translations.py b/tools/check_translations.py
new file mode 100644
index 000000000..4bea040bf
--- /dev/null
+++ b/tools/check_translations.py
@@ -0,0 +1,23 @@
+# Validate that all entries in the .pot are in every .po. Only the .pot is updated so we can detect
+# if a translation was added to the source but isn't in a .po. This ensures translators can grab
+# complete files to work on.
+
+import sys
+import polib
+
+
+template_filename = sys.argv[1]
+po_filenames = sys.argv[2:]
+
+template = polib.pofile(template_filename)
+all_ids = set([x.msgid for x in template])
+for po_filename in po_filenames:
+ print("Checking", po_filename)
+ po_file = polib.pofile(po_filename)
+ po_ids = set([x.msgid for x in po_file])
+
+ if all_ids - po_ids:
+ print("Missing message id. Please run `make translate`")
+ sys.exit(-1)
+ else:
+ print("ok")
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py
index eeb760a5f..7deb76a8d 100755
--- a/tools/mpy-tool.py
+++ b/tools/mpy-tool.py
@@ -571,7 +571,7 @@ def main():
# set config values for qstrs, and get the existing base set of qstrs
if args.qstr_header:
- qcfgs, base_qstrs = qstrutil.parse_input_headers([args.qstr_header])
+ qcfgs, base_qstrs, _ = qstrutil.parse_input_headers([args.qstr_header])
config.MICROPY_QSTR_BYTES_IN_LEN = int(qcfgs['BYTES_IN_LEN'])
config.MICROPY_QSTR_BYTES_IN_HASH = int(qcfgs['BYTES_IN_HASH'])
else: