2018-06-24 16:41:58 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-06-16 15:21:01 +02:00
|
|
|
#
|
2023-08-16 19:27:31 +02:00
|
|
|
# Copyright (c) 2018-2019 The Bitcoin Core developers
|
2018-06-16 15:21:01 +02:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#
|
|
|
|
# Make sure we explicitly open all text files using UTF-8 (or ASCII) encoding to
|
|
|
|
# avoid potential issues on the BSDs where the locale is not always set.
|
|
|
|
|
2018-06-18 14:32:53 +02:00
|
|
|
export LC_ALL=C
|
2018-06-16 15:21:01 +02:00
|
|
|
EXIT_CODE=0
|
2023-09-28 13:14:48 +02:00
|
|
|
OUTPUT=$(git grep " open(" -- "*.py" ":(exclude)src/crc32c/" ":(exclude)src/secp256k1/" | grep -vE "encoding=.(ascii|utf8|utf-8)." | grep -vE "open\([^,]*, ['\"][^'\"]*b[^'\"]*['\"]")
|
2018-06-16 15:21:01 +02:00
|
|
|
if [[ ${OUTPUT} != "" ]]; then
|
|
|
|
echo "Python's open(...) seems to be used to open text files without explicitly"
|
|
|
|
echo "specifying encoding=\"utf8\":"
|
|
|
|
echo
|
|
|
|
echo "${OUTPUT}"
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
2023-09-28 13:14:48 +02:00
|
|
|
OUTPUT=$(git grep "check_output(" -- "*.py" ":(exclude)src/crc32c/" ":(exclude)src/secp256k1/" | grep "universal_newlines=True" | grep -vE "encoding=.(ascii|utf8|utf-8).")
|
2018-09-04 12:31:00 +02:00
|
|
|
if [[ ${OUTPUT} != "" ]]; then
|
|
|
|
echo "Python's check_output(...) seems to be used to get program outputs without explicitly"
|
|
|
|
echo "specifying encoding=\"utf8\":"
|
|
|
|
echo
|
|
|
|
echo "${OUTPUT}"
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
2018-06-16 15:21:01 +02:00
|
|
|
exit ${EXIT_CODE}
|