Skip to content

Commit 1803143

Browse files
authored
Fix lint_and_format.sh compatibility issues for MacOS (UBC-Thunderbots#3679)
* Remove unused chmod * Upgrade ansible-lint version * Link clang-format in mac setup script * Fix commands in lint_and_format for compatibility
1 parent ded85a1 commit 1803143

5 files changed

Lines changed: 14 additions & 8 deletions

File tree

environment_setup/macos_requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ansible-lint==24.12.2
1+
ansible-lint==26.4.0
22
pyqtgraph==0.13.7
33
thefuzz==0.19.0
44
iterfzf==0.5.0.20.0
@@ -10,4 +10,3 @@ pyqt-toast-notification==1.3.2
1010
grpcio-tools==1.71.0
1111
platformio==6.1.18
1212
pyqt6==6.9.1
13-

environment_setup/setup_software_mac.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ print_status_msg "Setting Up Python Environment"
5151

5252
# Create virtual environment
5353
sudo python3.12 -m venv /opt/tbotspython
54-
chmod
5554
source /opt/tbotspython/bin/activate
5655

5756
# Install Python dependencies
@@ -69,6 +68,10 @@ sudo chmod +x "$CURR_DIR/../src/software/autoref/run_autoref.sh"
6968
sudo cp "$CURR_DIR/../src/software/autoref/DIV_B.txt" "/opt/tbotspython/autoReferee/config/geometry/DIV_B.txt"
7069
print_status_msg "Finished setting up AutoRef"
7170

71+
print_status_msg "Install clang-format"
72+
install_clang_format $sys
73+
print_status_msg "Done installing clang-format"
74+
7275
print_status_msg "Setting up cross compiler for robot software"
7376
install_cross_compiler $sys
7477
print_status_msg "Done setting up cross compiler for robot software"

environment_setup/ubuntu24_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ansible-lint==25.8.1
1+
ansible-lint==26.4.0
22
pyqtgraph==0.13.7
33
thefuzz==0.19.0
44
iterfzf==0.5.0.20.0

environment_setup/util.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ install_bazel() {
2929
}
3030

3131
install_clang_format() {
32-
ln -s /usr/bin/clang-format-14 /opt/tbotspython/bin/clang-format
32+
if is_darwin $1; then
33+
ln -s /opt/homebrew/bin/clang-format /opt/tbotspython/bin/clang-format
34+
else
35+
ln -s /usr/bin/clang-format-14 /opt/tbotspython/bin/clang-format
36+
fi
3337
}
3438

3539
install_cross_compiler() {

scripts/lint_and_format.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function run_clang_format () {
2525
cd $BAZEL_ROOT_DIR
2626

2727
# Generate extension string
28-
# Formatted as -iname *.EXTENSION -o
28+
# Formatted as -name *.EXTENSION -o
2929
EXTENSION_STRING=""
3030
for value in "${CLANG_FORMAT_EXTENSIONS[@]}"
3131
do
@@ -35,8 +35,8 @@ function run_clang_format () {
3535
# Find all the files that we want to format, and pass them to
3636
# clang-format as arguments
3737
# We remove the last -o flag from the extension string
38-
find $CURR_DIR/../src/ ${EXTENSION_STRING::-2} \
39-
| xargs -I{} -n1000 $CLANG_BIN -i -style=file:$CURR_DIR/../.clang-format
38+
find $CURR_DIR/../src ${EXTENSION_STRING% -o} \
39+
| xargs $CLANG_BIN -i -style=file:$CURR_DIR/../.clang-format
4040

4141
if [[ "$?" != 0 ]]; then
4242
printf "\n***Failed to run clang-format over all files!***\n\n"

0 commit comments

Comments
 (0)