|
@@ -5,6 +5,8 @@ PYTHONPATH=$BASE_DIR
|
5
|
5
|
SEARX_DIR="$BASE_DIR/searx"
|
6
|
6
|
ACTION=$1
|
7
|
7
|
|
|
8
|
+cd "$BASE_DIR"
|
|
9
|
+
|
8
|
10
|
update_packages() {
|
9
|
11
|
pip install -r "$BASE_DIR/requirements.txt"
|
10
|
12
|
}
|
|
@@ -14,16 +16,17 @@ update_dev_packages() {
|
14
|
16
|
pip install -r "$BASE_DIR/requirements-dev.txt"
|
15
|
17
|
}
|
16
|
18
|
|
17
|
|
-check_geckodriver() {
|
|
19
|
+install_geckodriver() {
|
18
|
20
|
echo '[!] Checking geckodriver'
|
|
21
|
+ # TODO : check the current geckodriver version
|
19
|
22
|
set -e
|
20
|
23
|
geckodriver -V 2>1 > /dev/null || NOTFOUND=1
|
21
|
24
|
set +e
|
22
|
25
|
if [ -z $NOTFOUND ]; then
|
23
|
26
|
return
|
24
|
27
|
fi
|
25
|
|
- GECKODRIVER_VERSION="v0.14.0"
|
26
|
|
- PLATFORM=`python -c "import platform; print platform.system().lower(), platform.architecture()[0]"`
|
|
28
|
+ GECKODRIVER_VERSION="v0.18.0"
|
|
29
|
+ PLATFORM=`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`
|
27
|
30
|
case $PLATFORM in
|
28
|
31
|
"linux 32bit" | "linux2 32bit") ARCH="linux32";;
|
29
|
32
|
"linux 64bit" | "linux2 64bit") ARCH="linux64";;
|
|
@@ -32,16 +35,25 @@ check_geckodriver() {
|
32
|
35
|
"mac 64bit") ARCH="macos";;
|
33
|
36
|
esac
|
34
|
37
|
GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
|
35
|
|
- if [ -z "$VIRTUAL_ENV" ]; then
|
36
|
|
- echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL"
|
37
|
|
- exit
|
|
38
|
+
|
|
39
|
+ if [ -z "$1" ]; then
|
|
40
|
+ if [ -z "$VIRTUAL_ENV" ]; then
|
|
41
|
+ echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL"
|
|
42
|
+ exit
|
|
43
|
+ else
|
|
44
|
+ GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
|
|
45
|
+ fi
|
38
|
46
|
else
|
39
|
|
- echo "Installing $VIRTUAL_ENV from\n $GECKODRIVER_URL"
|
40
|
|
- FILE=`mktemp`
|
41
|
|
- wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $VIRTUAL_ENV/bin/ -f $FILE geckodriver
|
42
|
|
- rm $FILE
|
43
|
|
- chmod 777 $VIRTUAL_ENV/bin/geckodriver
|
|
47
|
+ GECKODRIVER_DIR="$1"
|
|
48
|
+ mkdir -p "$GECKODRIVER_DIR"
|
44
|
49
|
fi
|
|
50
|
+
|
|
51
|
+ echo "Installing $GECKODRIVER_DIR/geckodriver from\n $GECKODRIVER_URL"
|
|
52
|
+
|
|
53
|
+ FILE=`mktemp`
|
|
54
|
+ wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C "$GECKODRIVER_DIR" -f $FILE geckodriver
|
|
55
|
+ rm $FILE
|
|
56
|
+ chmod 777 "$GECKODRIVER_DIR/geckodriver"
|
45
|
57
|
}
|
46
|
58
|
|
47
|
59
|
pep8_check() {
|
|
@@ -73,37 +85,49 @@ tests() {
|
73
|
85
|
set -e
|
74
|
86
|
pep8_check
|
75
|
87
|
unit_tests
|
76
|
|
- check_geckodriver
|
|
88
|
+ install_geckodriver
|
77
|
89
|
robot_tests
|
78
|
90
|
set +e
|
79
|
91
|
}
|
80
|
92
|
|
81
|
93
|
build_style() {
|
82
|
|
- # lessc -x "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
|
83
|
94
|
lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
|
84
|
95
|
}
|
85
|
96
|
|
86
|
97
|
styles() {
|
87
|
98
|
echo '[!] Building styles'
|
88
|
|
- build_style themes/legacy/less/style.less themes/legacy/css/style.css
|
89
|
|
- build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
|
90
|
|
- build_style themes/courgette/less/style.less themes/courgette/css/style.css
|
91
|
|
- build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
|
92
|
|
- build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
|
93
|
|
- build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
|
94
|
|
- build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
|
95
|
|
- build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
|
96
|
|
- build_style themes/simple/less/style.less themes/simple/css/searx.min.css
|
97
|
|
- build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
|
|
99
|
+ build_style themes/legacy/less/style.less themes/legacy/css/style.css
|
|
100
|
+ build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
|
|
101
|
+ build_style themes/courgette/less/style.less themes/courgette/css/style.css
|
|
102
|
+ build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
|
|
103
|
+ build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
|
|
104
|
+ build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
|
|
105
|
+ # built using grunt
|
|
106
|
+ #build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
|
|
107
|
+ #build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
|
|
108
|
+ #build_style themes/simple/less/style.less themes/simple/css/searx.min.css
|
|
109
|
+ #build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
|
|
110
|
+}
|
|
111
|
+
|
|
112
|
+npm_packages() {
|
|
113
|
+ echo '[!] install NPM packages for oscar theme'
|
|
114
|
+ cd $BASE_DIR/searx/static/themes/oscar
|
|
115
|
+ npm install
|
|
116
|
+
|
|
117
|
+ echo '[!] install NPM packages for simple theme'
|
|
118
|
+ cd $BASE_DIR/searx/static/themes/simple
|
|
119
|
+ npm install
|
98
|
120
|
}
|
99
|
121
|
|
100
|
122
|
grunt_build() {
|
101
|
|
- grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
|
102
|
|
- grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
|
|
123
|
+ echo '[!] Grunt build : oscar theme'
|
|
124
|
+ grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
|
|
125
|
+ echo '[!] Grunt build : simple theme'
|
|
126
|
+ grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
|
103
|
127
|
}
|
104
|
128
|
|
105
|
129
|
locales() {
|
106
|
|
- pybabel compile -d "$SEARX_DIR/translations"
|
|
130
|
+ pybabel compile -d "$SEARX_DIR/translations"
|
107
|
131
|
}
|
108
|
132
|
|
109
|
133
|
help() {
|
|
@@ -112,6 +136,7 @@ help() {
|
112
|
136
|
|
113
|
137
|
Commands
|
114
|
138
|
========
|
|
139
|
+ npm_packages - Download & install dependencies
|
115
|
140
|
grunt_build - Build js files
|
116
|
141
|
help - This text
|
117
|
142
|
locales - Compile locales
|
|
@@ -123,10 +148,10 @@ Commands
|
123
|
148
|
unit_tests - Run unit tests
|
124
|
149
|
update_dev_packages - Check & update development and production dependency changes
|
125
|
150
|
update_packages - Check & update dependency changes
|
126
|
|
- check_geckodriver - Check & download geckodriver (required for robot_tests)
|
|
151
|
+ install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests)
|
127
|
152
|
"
|
128
|
153
|
}
|
129
|
154
|
|
130
|
155
|
[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
|
131
|
156
|
&& help "action not found" \
|
132
|
|
- || $ACTION
|
|
157
|
+ || $ACTION "$2"
|