@@ -27,23 +27,28 @@ help:
27 @echo ' uninstall - uninstall (./local)'
27 @echo ' uninstall - uninstall (./local)'
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'
31+ @echo ' buildenv - re-build environment files (aka brand)'
32+ @echo ' themes - re-build build the source of the themes'
33+ @echo ' docker - build Docker image'
34+ @echo ' node.env - download & install npm dependencies locally'
31 @$(MAKE) -s -f utils/makefile.include make-help
36 @$(MAKE) -s -f utils/makefile.include make-help
33 @$(MAKE) -s -f utils/makefile.python python-help
38 @$(MAKE) -s -f utils/makefile.python python-help
35PHONY += install
40PHONY += install
36−install: pyenvinstall
41+install: buildenv pyenvinstall
38PHONY += uninstall
43PHONY += uninstall
39uninstall: pyenvuninstall
44uninstall: pyenvuninstall
41PHONY += clean
46PHONY += clean
42−clean: pyclean
47+clean: pyclean node.clean test.clean
43 $(call cmd,common_clean)
48 $(call cmd,common_clean)
45PHONY += run
50PHONY += run
46−run: pyenvinstall
51+run: buildenv pyenvinstall
48 sed -i -e "s/debug : False/debug : True/g" ./searx/settings.yml ; \
53 sed -i -e "s/debug : False/debug : True/g" ./searx/settings.yml ; \
49 sleep 2 ; \
54 sleep 2 ; \
@@ -57,36 +62,174 @@ run: pyenvinstall
59PHONY += docs
64PHONY += docs
60−docs: pyenvinstall sphinx-doc
65+docs: buildenv pyenvinstall sphinx-doc
61 $(call cmd,sphinx,html,docs,docs)
66 $(call cmd,sphinx,html,docs,docs)
63PHONY += docs-live
68PHONY += docs-live
64−docs-live: pyenvinstall sphinx-live
69+docs-live: buildenv pyenvinstall sphinx-live
65 $(call cmd,sphinx_autobuild,html,docs,docs)
70 $(call cmd,sphinx_autobuild,html,docs,docs)
67$(GH_PAGES)::
72$(GH_PAGES)::
68 @echo "doc available at --> $(DOCS_URL)"
73 @echo "doc available at --> $(DOCS_URL)"
75+# update project files
76+# --------------------
78+PHONY += project engines.languages useragents.update buildenv
80+project: buildenv useragents.update engines.languages
82+engines.languages: pyenvinstall
83+ $(Q)echo "fetch languages .."
84+ $(Q)$(PY_ENV_ACT); python utils/fetch_languages.py
85+ $(Q)echo "update searx/data/engines_languages.json"
86+ $(Q)mv engines_languages.json searx/data/engines_languages.json
87+ $(Q)echo "update searx/languages.py"
88+ $(Q)mv languages.py searx/languages.py
90+useragents.update: pyenvinstall
91+ $(Q)echo "Update searx/data/useragents.json with the most recent versions of Firefox."
92+ $(Q)$(PY_ENV_ACT); python utils/fetch_firefox_version.py
95+ $(Q)echo "build searx/brand.py"
96+ $(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
97+ $(Q)echo "ISSUE_URL = 'https://github.com/asciimoo/searx/issues'" >> searx/brand.py
98+ $(Q)echo "SEARX_URL = '$(SEARX_URL)'" >> searx/brand.py
99+ $(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
100+ $(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
101+ $(Q)echo "build utils/brand.env"
102+ $(Q)echo "export GIT_URL='$(GIT_URL)'" > utils/brand.env
103+ $(Q)echo "export ISSUE_URL='https://github.com/asciimoo/searx/issues'" >> utils/brand.env
104+ $(Q)echo "export SEARX_URL='$(SEARX_URL)'" >> utils/brand.env
105+ $(Q)echo "export DOCS_URL='$(DOCS_URL)'" >> utils/brand.env
106+ $(Q)echo "export PUBLIC_INSTANCES='https://searx.space'" >> utils/brand.env
113+ $(Q)./manage.sh npm_packages
116+ $(Q)echo "CLEAN locally installed npm dependencies"
119+ ./package-lock.json \
120+ ./searx/static/themes/oscar/package-lock.json \
121+ ./searx/static/themes/oscar/node_modules \
122+ ./searx/static/themes/simple/package-lock.json \
123+ ./searx/static/themes/simple/node_modules
128+PHONY += themes.bootstrap themes themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
129+themes: buildenv themes.bootstrap themes.oscar themes.simple themes.legacy themes.courgette themes.pixart
131+quiet_cmd_lessc = LESSC $3
132+ cmd_lessc = PATH="$$(npm bin):$$PATH" \
133+ lessc --clean-css="--s1 --advanced --compatibility=ie9" "searx/static/$2" "searx/static/$3"
135+quiet_cmd_grunt = GRUNT $2
136+ cmd_grunt = PATH="$$(npm bin):$$PATH" \
137+ grunt --gruntfile "$2"
140+ $(Q)echo '[!] build oscar theme'
141+ $(call cmd,grunt,searx/static/themes/oscar/gruntfile.js)
144+ $(Q)echo '[!] build simple theme'
145+ $(call cmd,grunt,searx/static/themes/simple/gruntfile.js)
148+ $(Q)echo '[!] build legacy theme'
149+ $(call cmd,lessc,themes/legacy/less/style-rtl.less,themes/legacy/css/style-rtl.css)
150+ $(call cmd,lessc,themes/legacy/less/style.less,themes/legacy/css/style.css)
153+ $(Q)echo '[!] build courgette theme'
154+ $(call cmd,lessc,themes/courgette/less/style.less,themes/courgette/css/style.css)
155+ $(call cmd,lessc,themes/courgette/less/style-rtl.less,themes/courgette/css/style-rtl.css)
158+ $(Q)echo '[!] build pixart theme'
159+ $(call cmd,lessc,themes/pix-art/less/style.less,themes/pix-art/css/style.css)
162+ $(call cmd,lessc,less/bootstrap/bootstrap.less,css/bootstrap.min.css)
170+ $(Q)./manage.sh docker_build
172+docker.push: buildenv
173+ $(Q)./manage.sh docker_build push
178+PHONY += gecko.driver
180+ $(PY_ENV_ACT); ./manage.sh install_geckodriver
73−PHONY += test test.pylint test.pep8 test.unit test.robot
185+PHONY += test test.pylint test.pep8 test.unit test.coverage test.robot
75−test: test.pylint test.pep8 test.unit test.robot
187+test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot
191+ @echo "LINT skip liniting py2"
77# TODO: balance linting with pylint
193# TODO: balance linting with pylint
78test.pylint: pyenvinstall
194test.pylint: pyenvinstall
79− $(call cmd,pylint,searx/preferences.py)
196+ searx/preferences.py \
80− $(call cmd,pylint,searx/testing.py)
197+ searx/testing.py \
202+# E402 module level import not at top of file
203+# W503 line break before binary operator
82test.pep8: pyenvinstall
205test.pep8: pyenvinstall
83− $(PY_ENV_ACT); ./manage.sh pep8_check
206+ @echo "TEST pep8"
207+ $(Q)$(PY_ENV_ACT); pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" searx tests
85test.unit: pyenvinstall
209test.unit: pyenvinstall
86− $(PY_ENV_ACT); ./manage.sh unit_tests
210+ @echo "TEST tests/unit"
211+ $(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
213+test.coverage: pyenvinstall
214+ @echo "TEST unit test coverage"
215+ $(Q)$(PY_ENV_ACT); \
216+ python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
217+ && coverage report \
88−test.robot: pyenvinstall
220+test.robot: pyenvinstall gecko.driver
89− $(PY_ENV_ACT); ./manage.sh install_geckodriver
221+ @echo "TEST robot"
90− $(PY_ENV_ACT); ./manage.sh robot_tests
222+ $(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
225+ @echo "CLEAN intermediate test stuff"
226+ $(Q)rm -rf geckodriver.log .coverage coverage/
233+ $(Q)$(PY_ENV_BIN)/python -m pip install codecov
92.PHONY: $(PHONY)
235.PHONY: $(PHONY)