-
Notifications
You must be signed in to change notification settings - Fork 2
/
format.sh
executable file
·70 lines (62 loc) · 1.48 KB
/
format.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
BASE_FOLDER=$(pwd)
BASE_TEST_FOLDER=./tests
BASE_TOOLS_FOLDER=./tools
LIB_FOLDER=./src
TEST_FIRMWARES="test_firmware_usb_loopback test_firmware_loopback test_firmware_hspi test_firmware_serdes test_firmware_usb_speedtest test_firmware_unittests"
TOOLS_FIRMWARES="firmware_debug_board"
SCRIPTS_FOLDERS="${BASE_TOOLS_FOLDER}/scripts ${BASE_TEST_FOLDER}/scripts"
if [ $# -eq 0 ]
then
echo "Usage : ./build.sh all|lib|tests|tools"
exit
fi
format_lib(){
cd ${LIB_FOLDER} || exit
sh format.sh || (cd "${BASE_FOLDER}" && exit)
cd ${BASE_FOLDER} || exit
}
format_tests(){
for firmware in ${TEST_FIRMWARES}
do
cd ${BASE_FOLDER}/"${BASE_TEST_FOLDER}"/"$firmware" || exit
sh format.sh || (cd "${BASE_FOLDER}" && exit)
cd ${BASE_FOLDER} || exit
done
}
format_tools(){
for firmware in ${TOOLS_FIRMWARES}
do
cd ${BASE_FOLDER}/"${BASE_TOOLS_FOLDER}"/"$firmware" || exit
sh format.sh || (cd "${BASE_FOLDER}" && exit)
cd ${BASE_FOLDER} || exit
done
}
format_scripts(){
for folder in ${SCRIPTS_FOLDERS}
do
autopep8 -i -r "$folder"/*.py --verbose || exit
done
}
if [ "$1" = "all" ];
then
format_lib;
format_tests;
format_tools;
format_scripts
elif [ "$1" = "lib" ];
then
format_lib;
elif [ "$1" = "tests" ];
then
format_tests;
elif [ "$1" = "tools" ];
then
format_tools;
elif [ "$1" = "scripts" ];
then
format_scripts;
else
echo "Please enter a valid command"
exit;
fi