-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtool
executable file
·114 lines (98 loc) · 2.98 KB
/
tool
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
ABSOLUTE_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P )
GREY="\e[0;37m"
MAGENTA="\e[0;35m"
RED="\e[0;31m"
GREEN="\e[0;32m"
CLEAR="\e[0m"
function help {
echo ""
echo "curve tool"
echo ""
echo " usage: tool <command>"
echo ""
echo " available commands:"
echo " run - run the game"
echo " build - build the game for this platform"
echo " setup - setup virtualenv and install dependencies"
echo " test - run unit tests"
echo " lint - lint the code"
echo " clean - clean up all temporary files"
echo " help - show this help"
echo ""
}
case "$1" in
("run")
${ABSOLUTE_PATH}/bin/python3 ${ABSOLUTE_PATH}/src/main.py
;;
("build")
${ABSOLUTE_PATH}/bin/python3 -OO -m PyInstaller \
${ABSOLUTE_PATH}/src/main.py \
--name="curve" \
--onefile \
--windowed \
--add-data="config/**:config/" \
--add-data="audio/**:audio/" \
--add-data="img/**:img/" \
--add-data="fonts/Exo/*:fonts/Exo/" \
--add-data="fonts/Muli/*:fonts/Muli/" \
--icon=img/icon.ico \
--workpath=${ABSOLUTE_PATH}/build \
--distpath=${ABSOLUTE_PATH}/dist \
--clean \
--strip
;;
("setup")
echo -e "${GREY}Checking for ${MAGENTA}python3${CLEAR}..."
command -v python3 --version >/dev/null 2>&1 || {
echo -e >&2 "${RED}Could not find python3. Please install it and check if it is included in your path.${CLEAR}"
exit 1
}
echo -e "${GREEN}Found python3${CLEAR}"
echo -e "${GREY}Checking for ${MAGENTA}pip3${CLEAR}..."
command -v pip3 --version >/dev/null 2>&1 || {
echo -e >&2 "${RED}Could not find pip3. Please install it and check if it is included in your path.${CLEAR}"
exit 1
}
echo -e "${GREEN}Found pip3${CLEAR}"
echo -e "${GREY}Checking for ${MAGENTA}virtualenv${CLEAR}..."
command -v virtualenv --version >/dev/null 2>&1 || {
echo -e >&2 "${RED}Could not find virtualenv. Please install it and check if it is included in your path.${CLEAR}"
exit 1
}
echo -e "${GREEN}Found virtualenv${CLEAR}"
if [ ! -d ${ABSOLUTE_PATH}/bin ]; then
echo -e "${GREY}Installing virtualenv...${CLEAR}"
virtualenv -p python3 .
echo -e "${GREEN}Installed virtualenv!${CLEAR}"
fi
echo -e "${GREY}virtualenv already installed.${CLEAR}"
echo -e "${GREY}Installing dependencies...${CLEAR}"
${ABSOLUTE_PATH}/bin/pip3 install -r ${ABSOLUTE_PATH}/requirements.txt
echo -e "${GREEN}Installed dependencies!${CLEAR}"
;;
("test")
${ABSOLUTE_PATH}/bin/python3 -m unittest discover -s ${ABSOLUTE_PATH}/test -p "*_test.py"
;;
("lint")
${ABSOLUTE_PATH}/bin/python3 -m pylint ${ABSOLUTE_PATH}/src/*.py
;;
("clean")
rm -rf ${ABSOLUTE_PATH}/dist
rm -rf ${ABSOLUTE_PATH}/build
rm -rf ${ABSOLUTE_PATH}/**/__pychache__ # TODO: not working
rm -f ${ABSOLUTE_PATH}/**.pyc
rm -f ${ABSOLUTE_PATH}/*.spec
rm -rf ${ABSOLUTE_PATH}/bin
rm -rf ${ABSOLUTE_PATH}/lib
rm -rf ${ABSOLUTE_PATH}/lib64
rm -rf ${ABSOLUTE_PATH}/incldude
rm -f ${ABSOLUTE_PATH}/pip-selfcheck.json
;;
("help")
help
;;
*)
help
;;
esac