Skip to content

Commit

Permalink
Tools: Install pre-commmit for mac, arch, ubuntu
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Sep 11, 2023
1 parent 27e5309 commit 48cc7b1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Tools/environment_install/install-prereqs-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ BASE_PKGS="base-devel ccache git gsfonts tk wget gcc"
SITL_PKGS="python-pip python-setuptools python-wheel python-wxpython opencv python-numpy python-scipy"
PX4_PKGS="lib32-glibc zip zlib ncurses"

PYTHON_PKGS="future lxml pymavlink MAVProxy pexpect argparse matplotlib pyparsing geocoder pyserial empy dronecan"
PYTHON_PKGS="future lxml pymavlink MAVProxy pexpect argparse matplotlib pyparsing geocoder pyserial empy dronecan pre-commit"

# GNU Tools for ARM Embedded Processors
# (see https://launchpad.net/gcc-arm-embedded/)
Expand Down Expand Up @@ -113,6 +113,10 @@ SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
(
cd "$SCRIPT_DIR"
git submodule update --init --recursive
if [[ $ENABLE_PRE_COMMIT -n 1 ]]; then
echo "Enabling pre-commit."
pre-commit install
fi
)

echo "Done. Please log out and log in again."
7 changes: 6 additions & 1 deletion Tools/environment_install/install-prereqs-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ if [[ $DO_AP_STM_ENV -eq 1 ]]; then
install_arm_none_eabi_toolchain
fi

PYTHON_PKGS="future lxml pymavlink MAVProxy pexpect geocoder flake8 empy dronecan"
PYTHON_PKGS="future lxml pymavlink MAVProxy pexpect geocoder flake8 empy dronecan pre-commit"
# add some Python packages required for commonly-used MAVProxy modules and hex file generation:
if [[ $SKIP_AP_EXT_ENV -ne 1 ]]; then
PYTHON_PKGS="$PYTHON_PKGS intelhex gnureadline"
Expand Down Expand Up @@ -225,4 +225,9 @@ echo "Done!"

git submodule update --init --recursive

if [[ $ENABLE_PRE_COMMIT -n 1 ]]; then
echo "Enabling pre-commit."
pre-commit install
fi

echo "finished"
8 changes: 7 additions & 1 deletion Tools/environment_install/install-prereqs-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fi

# Lists of packages to install
BASE_PKGS="build-essential ccache g++ gawk git make wget valgrind screen"
PYTHON_PKGS="future lxml pymavlink pyserial MAVProxy pexpect geocoder empy ptyprocess dronecan"
PYTHON_PKGS="future lxml pymavlink pyserial MAVProxy pexpect geocoder empy ptyprocess dronecan pre-commit"
PYTHON_PKGS="$PYTHON_PKGS flake8"

# add some Python packages required for commonly-used MAVProxy modules and hex file generation:
Expand Down Expand Up @@ -443,4 +443,10 @@ if $IS_DOCKER; then
echo "source ~/.ardupilot_env">> ~/.bashrc
fi

if [[ $ENABLE_PRE_COMMIT -n 1 ]]; then
echo "Enabling pre-commit."
cd $ARDUPILOT_ROOT
pre-commit install
fi

echo "---------- $0 end ----------"
7 changes: 7 additions & 0 deletions Tools/scripts/build_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@ for t in $CI_BUILD_TARGET; do
continue
fi

if [ "$t" == "pre-commit-cleanliness" ]; then
echo "Checking pre-commit code cleanliness"
pre-commit install
pre-commit run --all-files --verbose --show-diff-on-failure
continue
fi

if [ "$t" == "configure-all" ]; then
echo "Checking configure of all boards"
./Tools/scripts/configure_all.py
Expand Down

0 comments on commit 48cc7b1

Please sign in to comment.