| #!/bin/bash |
| |
| # Copyright 2021 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Runs autoformatters on our source files. |
| |
| PROJECT_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/..) |
| source "${PROJECT_ROOT}/environment" |
| |
| # If we're outside the chroot, rerun inside. |
| if [ ! -e /etc/cros_chroot_version ] ; then |
| exec "${PROJECT_ROOT}/scripts/run-tool" "$0" "$@" |
| fi |
| |
| # Format Python code. |
| autopep8 -i --aggressive "${PROJECT_ROOT}/soc"/*.py |
| |
| for d in "${HPS_RUST_DIRS[@]}"; do |
| ( |
| cd "${PROJECT_ROOT}/${d}" || exit |
| cargo fmt |
| ) |
| done |