summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-05-05 12:29:17 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-05 23:41:39 +0000
commit526043e053cb65b9fe9b54262e829710e060ae40 (patch)
tree092c8c77284bb5d2d7a0f8040a53baf2479d04b5
parent212ef472cc13372a0a70351f24fc0e1bbf29de8f (diff)
downloadchrome-ec-526043e053cb65b9fe9b54262e829710e060ae40.tar.gz
zephyr: zmake: Skip running flake8 on BUILD.py files during pre-upload
flake8 reports more errors than necessary on BUILD.py files because: - They are out of the zmake tree, and therefore do not have the correct .flake8 config file. - flake8 is confused by undefined variables like "here" and "register_project", which come from the execution context zmake provides. These are just config files anyway, running flake8 on them is likely overkill. Turn that off. BUG=none BRANCH=none TEST=for f in $(git ls-files); do zephyr/zmake/pre-upload.sh "$(realpath "${f}")" done Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia6eae025ec560d3f6dbdc5c8a4ce50d7b9b94459 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3630476 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
-rwxr-xr-xzephyr/zmake/pre-upload.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/zephyr/zmake/pre-upload.sh b/zephyr/zmake/pre-upload.sh
index 3c2c42b49e..15b6637f44 100755
--- a/zephyr/zmake/pre-upload.sh
+++ b/zephyr/zmake/pre-upload.sh
@@ -4,16 +4,22 @@
# found in the LICENSE file.
set -e
-AFFECTED_FILES=()
+ZMAKE_FILES=()
+BUILD_PY_FILES=()
for path in "$@"; do
case "${path}" in
- *zephyr/zmake/*.py | *zephyr/projects/*.py)
- AFFECTED_FILES+=("${path}")
+ *zephyr/zmake/*.py )
+ ZMAKE_FILES+=("${path}")
+ ;;
+ */BUILD.py )
+ BUILD_PY_FILES+=("${path}")
;;
esac
done
+AFFECTED_FILES=("${ZMAKE_FILES[@]}" "${BUILD_PY_FILES[@]}")
+
if [ "${#AFFECTED_FILES}" -eq 0 ]; then
# No zmake changes made, do nothing.
exit 0
@@ -46,7 +52,9 @@ if [ -f /etc/cros_chroot_version ]; then
cd "$(dirname "$(realpath -e "${BASH_SOURCE[0]}")")"
wrap_fix_msg black --check --diff "${AFFECTED_FILES[@]}"
wrap_fix_msg isort --check "${AFFECTED_FILES[@]}"
- flake8 "${AFFECTED_FILES[@]}" || EXIT_STATUS=1
+ if [ "${#ZMAKE_FILES[@]}" -gt 0 ]; then
+ flake8 "${ZMAKE_FILES[@]}" || EXIT_STATUS=1
+ fi
exit "${EXIT_STATUS}"
else
cat <<EOF >&2