@@ -28,6 +28,9 @@ help-min:
28 @echo ' gh-pages - build docs & deploy on gh-pages branch'
28 @echo ' gh-pages - build docs & deploy on gh-pages branch'
29 @echo ' clean - drop builds and environments'
29 @echo ' clean - drop builds and environments'
30 @echo ' project - re-build generic files of the searx project'
30 @echo ' project - re-build generic files of the searx project'
31+ @echo ' themes - re-build build the source of the themes'
32+ @echo ' docker - build Docker image'
33+ @echo ' node.env - download & install npm dependencies locally'
32 @echo 'environment'
35 @echo 'environment'
33 @echo ' SEARX_URL = $(SEARX_URL)'
36 @echo ' SEARX_URL = $(SEARX_URL)'
@@ -49,7 +52,7 @@ PHONY += uninstall
49uninstall: pyenvuninstall
52uninstall: pyenvuninstall
51PHONY += clean
54PHONY += clean
52−clean: pyclean docs-clean
55+clean: pyclean docs-clean node.clean test.clean
53 $(call cmd,common_clean)
56 $(call cmd,common_clean)
55PHONY += run
58PHONY += run
@@ -88,27 +91,124 @@ $(GH_PAGES)::
88# update project files
91# update project files
89# --------------------
92# --------------------
91−PHONY += project engines-languages
94+PHONY += project engines.languages searx.brand useragents.update
93−project: searx/data/engines_languages.json
96+project: useragents.update engines.languages searx.brand
95−searx/data/engines_languages.json: pyenvinstall
98+engines.languages: pyenvinstall
99+ $(Q)echo "fetch languages .."
96− $(PY_ENV_ACT); python utils/fetch_languages.py
100+ $(Q)$(PY_ENV_ACT); python utils/fetch_languages.py
101+ $(Q)echo "update searx/data/engines_languages.json"
97− mv engines_languages.json searx/data/engines_languages.json
102+ $(Q)mv engines_languages.json searx/data/engines_languages.json
103+ $(Q)echo "update searx/languages.py"
98− mv languages.py searx/languages.py
104+ $(Q)mv languages.py searx/languages.py
106+useragents.update: pyenvinstall
107+ $(Q)echo "Update searx/data/useragents.json with the most recent versions of Firefox."
108+ $(Q)$(PY_ENV_ACT); python utils/fetch_firefox_version.py
111+ $(Q)echo "build searx/brand.py"
112+ $(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
113+ $(Q)echo "ISSUE_URL = 'https://github.com/asciimoo/searx/issues'" >> searx/brand.py
114+ $(Q)echo "SEARX_URL = '$(SEARX_URL)'" >> searx/brand.py
115+ $(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
116+ $(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
117+ $(Q)echo "build utils/brand.env"
118+ $(Q)echo "export GIT_URL='$(GIT_URL)'" > utils/brand.env
119+ $(Q)echo "export ISSUE_URL='https://github.com/asciimoo/searx/issues'" >> utils/brand.env
120+ $(Q)echo "export SEARX_URL='$(SEARX_URL)'" >> utils/brand.env
121+ $(Q)echo "export DOCS_URL='$(DOCS_URL)'" >> utils/brand.env
122+ $(Q)echo "export PUBLIC_INSTANCES='https://searx.space'" >> utils/brand.env
129+ $(Q)./manage.sh npm_packages
132+ $(Q)echo "CLEAN locally installed npm dependencies"
135+ ./package-lock.json \
136+ ./searx/static/themes/oscar/package-lock.json \
137+ ./searx/static/themes/oscar/node_modules \
138+ ./searx/static/themes/simple/package-lock.json \
139+ ./searx/static/themes/simple/node_modules
144+PHONY += themes.bootstrap themes themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
145+themes: themes.bootstrap themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
147+quiet_cmd_lessc = LESSC $3
148+ cmd_lessc = PATH="$$(npm bin):$$PATH" \
149+ lessc --clean-css="--s1 --advanced --compatibility=ie9" "searx/static/$2" "searx/static/$3"
151+quiet_cmd_grunt = GRUNT $2
152+ cmd_grunt = PATH="$$(npm bin):$$PATH" \
153+ grunt --gruntfile "$2"
156+ $(Q)echo '[!] build oscar theme'
157+ $(call cmd,grunt,searx/static/themes/oscar/gruntfile.js)
160+ $(Q)echo '[!] build simple theme'
161+ $(call cmd,grunt,searx/static/themes/simple/gruntfile.js)
164+ $(Q)echo '[!] build legacy theme'
165+ $(call cmd,lessc,themes/legacy/less/style-rtl.less,themes/legacy/css/style-rtl.css)
166+ $(call cmd,lessc,themes/legacy/less/style.less,themes/legacy/css/style.css)
169+ $(Q)echo '[!] build courgette theme'
170+ $(call cmd,lessc,themes/courgette/less/style.less,themes/courgette/css/style.css)
171+ $(call cmd,lessc,themes/courgette/less/style-rtl.less,themes/courgette/css/style-rtl.css)
174+ $(Q)echo '[!] build pixart theme'
175+ $(call cmd,lessc,themes/pix-art/less/style.less,themes/pix-art/css/style.css)
178+ $(call cmd,lessc,less/bootstrap/bootstrap.less,css/bootstrap.min.css)
186+ $(Q)./manage.sh docker_build
191+PHONY += gecko.driver
193+ $(PY_ENV_ACT); ./manage.sh install_geckodriver
103−PHONY += test test.sh test.pylint test.pep8 test.unit test.robot
198+PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot
105−test: test.pylint test.pep8 test.unit test.robot
199+test: test.pylint test.pep8 test.unit gecko.driver test.robot
107# TODO: balance linting with pylint
201# TODO: balance linting with pylint
109test.pylint: pyenvinstall
203test.pylint: pyenvinstall
110− $(call cmd,pylint,searx/preferences.py)
205+ searx/preferences.py \
111− $(call cmd,pylint,searx/testing.py)
206+ searx/testing.py \
210+# E402 module level import not at top of file
211+# W503 line break before binary operator
113# ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported!
213# ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported!
@@ -121,13 +221,26 @@ test.sh:
121 shellcheck -x .config.sh
221 shellcheck -x .config.sh
123test.pep8: pyenvinstall
223test.pep8: pyenvinstall
124− $(PY_ENV_ACT); ./manage.sh pep8_check
224+ @echo "TEST pep8"
225+ $(Q)$(PY_ENV_ACT); pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" searx tests
126test.unit: pyenvinstall
227test.unit: pyenvinstall
127− $(PY_ENV_ACT); ./manage.sh unit_tests
228+ @echo "TEST tests/unit"
128−
229+ $(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
231+test.coverage: pyenvinstall
232+ @echo "TEST unit test coverage"
233+ $(Q)$(PY_ENV_ACT); \
234+ python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
235+ && coverage report \
129−test.robot: pyenvinstall
238+test.robot: pyenvinstall gecko.driver
130− $(PY_ENV_ACT); ./manage.sh install_geckodriver
239+ @echo "TEST robot"
131− $(PY_ENV_ACT); ./manage.sh robot_tests
240+ $(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
243+ @echo "CLEAN intermediate test stuff"
244+ $(Q)rm -rf geckodriver.log .coverage coverage/
133.PHONY: $(PHONY)
246.PHONY: $(PHONY)