2019-11-28 18:54:57 +00:00
|
|
|
# -*- coding: utf-8; mode: makefile-gmake -*-
|
2020-03-08 17:37:16 +00:00
|
|
|
.DEFAULT_GOAL=help
|
2019-11-28 18:54:57 +00:00
|
|
|
|
2020-03-15 16:01:36 +00:00
|
|
|
include utils/makefile.include
|
2019-12-04 15:48:36 +00:00
|
|
|
|
2019-11-28 18:54:57 +00:00
|
|
|
PYOBJECTS = searx
|
2019-12-12 11:10:32 +00:00
|
|
|
DOC = docs
|
2019-11-28 18:54:57 +00:00
|
|
|
PY_SETUP_EXTRAS ?= \[test\]
|
2021-01-12 08:53:26 +00:00
|
|
|
PYLINT_SEARX_DISABLE_OPTION := I,C,R,W0105,W0212,W0511,W0603,W0613,W0621,W0702,W0703,W1401,E1136
|
2020-11-16 08:45:00 +00:00
|
|
|
PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES := supported_languages,language_aliases
|
2019-11-28 18:54:57 +00:00
|
|
|
|
|
|
|
include utils/makefile.python
|
2019-12-12 11:10:32 +00:00
|
|
|
include utils/makefile.sphinx
|
2019-11-28 18:54:57 +00:00
|
|
|
|
|
|
|
all: clean install
|
|
|
|
|
2020-03-21 17:45:38 +00:00
|
|
|
PHONY += help-min help-all help
|
|
|
|
|
|
|
|
help: help-min
|
|
|
|
@echo ''
|
|
|
|
@echo 'to get more help: make help-all'
|
|
|
|
|
|
|
|
help-min:
|
2019-11-28 19:05:29 +00:00
|
|
|
@echo ' test - run developer tests'
|
2019-12-12 11:10:32 +00:00
|
|
|
@echo ' docs - build documentation'
|
|
|
|
@echo ' docs-live - autobuild HTML documentation while editing'
|
2019-11-28 18:54:57 +00:00
|
|
|
@echo ' run - run developer instance'
|
|
|
|
@echo ' install - developer install (./local)'
|
|
|
|
@echo ' uninstall - uninstall (./local)'
|
2019-12-12 13:15:41 +00:00
|
|
|
@echo ' gh-pages - build docs & deploy on gh-pages branch'
|
2019-12-18 15:11:05 +00:00
|
|
|
@echo ' clean - drop builds and environments'
|
2020-03-01 06:56:46 +00:00
|
|
|
@echo ' project - re-build generic files of the searx project'
|
2020-03-30 10:23:01 +00:00
|
|
|
@echo ' buildenv - re-build environment files (aka brand)'
|
2020-03-25 13:09:47 +00:00
|
|
|
@echo ' themes - re-build build the source of the themes'
|
2020-03-25 13:50:39 +00:00
|
|
|
@echo ' docker - build Docker image'
|
2020-03-25 15:38:52 +00:00
|
|
|
@echo ' node.env - download & install npm dependencies locally'
|
2019-11-28 18:54:57 +00:00
|
|
|
@echo ''
|
2020-03-21 17:45:38 +00:00
|
|
|
@$(MAKE) -e -s make-help
|
|
|
|
|
|
|
|
help-all: help-min
|
|
|
|
@echo ''
|
|
|
|
@$(MAKE) -e -s python-help
|
2019-11-28 18:54:57 +00:00
|
|
|
@echo ''
|
2020-03-21 17:45:38 +00:00
|
|
|
@$(MAKE) -e -s docs-help
|
2019-11-28 18:54:57 +00:00
|
|
|
|
|
|
|
PHONY += install
|
2020-03-30 10:23:01 +00:00
|
|
|
install: buildenv pyenvinstall
|
2019-11-28 18:54:57 +00:00
|
|
|
|
|
|
|
PHONY += uninstall
|
|
|
|
uninstall: pyenvuninstall
|
|
|
|
|
|
|
|
PHONY += clean
|
2020-03-29 11:03:27 +00:00
|
|
|
clean: pyclean docs-clean node.clean test.clean
|
2019-11-28 18:54:57 +00:00
|
|
|
$(call cmd,common_clean)
|
|
|
|
|
|
|
|
PHONY += run
|
2020-03-30 10:23:01 +00:00
|
|
|
run: buildenv pyenvinstall
|
2019-11-28 18:54:57 +00:00
|
|
|
$(Q) ( \
|
|
|
|
sleep 2 ; \
|
|
|
|
xdg-open http://127.0.0.1:8888/ ; \
|
|
|
|
) &
|
2020-10-31 14:40:55 +00:00
|
|
|
SEARX_DEBUG=1 $(PY_ENV)/bin/python ./searx/webapp.py
|
2019-11-28 18:54:57 +00:00
|
|
|
|
2019-12-12 11:10:32 +00:00
|
|
|
# docs
|
|
|
|
# ----
|
|
|
|
|
2020-06-18 16:44:22 +00:00
|
|
|
sphinx-doc-prebuilds:: buildenv pyenvinstall prebuild-includes
|
|
|
|
|
2019-12-12 11:10:32 +00:00
|
|
|
PHONY += docs
|
2020-09-20 05:51:01 +00:00
|
|
|
docs: sphinx-doc-prebuilds
|
2019-12-12 11:10:32 +00:00
|
|
|
$(call cmd,sphinx,html,docs,docs)
|
|
|
|
|
|
|
|
PHONY += docs-live
|
2020-09-20 05:51:01 +00:00
|
|
|
docs-live: sphinx-doc-prebuilds
|
2019-12-12 11:10:32 +00:00
|
|
|
$(call cmd,sphinx_autobuild,html,docs,docs)
|
|
|
|
|
2020-06-18 16:44:22 +00:00
|
|
|
PHONY += prebuild-includes
|
2020-03-02 18:00:19 +00:00
|
|
|
prebuild-includes:
|
2020-06-18 16:44:22 +00:00
|
|
|
$(Q)mkdir -p $(DOCS_BUILD)/includes
|
|
|
|
$(Q)./utils/searx.sh doc | cat > $(DOCS_BUILD)/includes/searx.rst
|
|
|
|
$(Q)./utils/filtron.sh doc | cat > $(DOCS_BUILD)/includes/filtron.rst
|
|
|
|
$(Q)./utils/morty.sh doc | cat > $(DOCS_BUILD)/includes/morty.rst
|
2020-03-02 18:00:19 +00:00
|
|
|
|
|
|
|
|
2019-12-13 11:58:46 +00:00
|
|
|
$(GH_PAGES)::
|
|
|
|
@echo "doc available at --> $(DOCS_URL)"
|
2019-12-12 11:10:32 +00:00
|
|
|
|
2020-03-01 06:56:46 +00:00
|
|
|
# update project files
|
|
|
|
# --------------------
|
|
|
|
|
2020-03-30 10:23:01 +00:00
|
|
|
PHONY += project engines.languages useragents.update buildenv
|
2020-03-01 06:56:46 +00:00
|
|
|
|
2020-03-30 10:23:01 +00:00
|
|
|
project: buildenv useragents.update engines.languages
|
2020-03-01 06:56:46 +00:00
|
|
|
|
2020-03-26 12:32:08 +00:00
|
|
|
engines.languages: pyenvinstall
|
|
|
|
$(Q)echo "fetch languages .."
|
2021-03-08 15:14:33 +00:00
|
|
|
$(Q)$(PY_ENV_ACT); python ./searx_extra/update/update_languages.py
|
|
|
|
$(Q)echo "updated searx/data/engines_languages.json"
|
|
|
|
$(Q)echo "updated searx/languages.py"
|
2020-03-26 12:32:08 +00:00
|
|
|
|
|
|
|
useragents.update: pyenvinstall
|
2021-03-08 15:14:33 +00:00
|
|
|
$(Q)echo "fetch useragents .."
|
|
|
|
$(Q)$(PY_ENV_ACT); python ./searx_extra/update/update_firefox_version.py
|
|
|
|
$(Q)echo "updated searx/data/useragents.json with the most recent versions of Firefox."
|
2020-03-01 06:56:46 +00:00
|
|
|
|
2020-12-20 23:37:45 +00:00
|
|
|
buildenv: pyenv
|
|
|
|
$(Q)$(PY_ENV_ACT); SEARX_DEBUG=1 python utils/build_env.py
|
2020-03-25 10:49:33 +00:00
|
|
|
|
2020-03-25 15:38:52 +00:00
|
|
|
# node / npm
|
|
|
|
# ----------
|
|
|
|
|
2020-03-30 10:23:01 +00:00
|
|
|
node.env: buildenv
|
2020-03-25 15:38:52 +00:00
|
|
|
$(Q)./manage.sh npm_packages
|
|
|
|
|
|
|
|
node.clean:
|
|
|
|
$(Q)echo "CLEAN locally installed npm dependencies"
|
|
|
|
$(Q)rm -rf \
|
|
|
|
./node_modules \
|
|
|
|
./package-lock.json \
|
|
|
|
./searx/static/themes/oscar/package-lock.json \
|
|
|
|
./searx/static/themes/oscar/node_modules \
|
|
|
|
./searx/static/themes/simple/package-lock.json \
|
|
|
|
./searx/static/themes/simple/node_modules
|
|
|
|
|
2020-03-25 13:09:47 +00:00
|
|
|
# build themes
|
|
|
|
# ------------
|
|
|
|
|
2021-03-10 18:41:05 +00:00
|
|
|
PHONY += themes themes.oscar themes.simple
|
|
|
|
themes: buildenv themes.oscar themes.simple
|
2020-03-25 13:09:47 +00:00
|
|
|
|
2020-03-29 09:29:57 +00:00
|
|
|
quiet_cmd_lessc = LESSC $3
|
|
|
|
cmd_lessc = PATH="$$(npm bin):$$PATH" \
|
|
|
|
lessc --clean-css="--s1 --advanced --compatibility=ie9" "searx/static/$2" "searx/static/$3"
|
2020-03-25 13:09:47 +00:00
|
|
|
|
2020-03-29 09:29:57 +00:00
|
|
|
quiet_cmd_grunt = GRUNT $2
|
|
|
|
cmd_grunt = PATH="$$(npm bin):$$PATH" \
|
|
|
|
grunt --gruntfile "$2"
|
2020-03-26 17:00:07 +00:00
|
|
|
|
2020-05-15 07:57:09 +00:00
|
|
|
themes.oscar: node.env
|
2020-03-29 09:29:57 +00:00
|
|
|
$(Q)echo '[!] build oscar theme'
|
|
|
|
$(call cmd,grunt,searx/static/themes/oscar/gruntfile.js)
|
2020-03-26 17:00:07 +00:00
|
|
|
|
2020-05-15 07:57:09 +00:00
|
|
|
themes.simple: node.env
|
2020-03-29 09:29:57 +00:00
|
|
|
$(Q)echo '[!] build simple theme'
|
|
|
|
$(call cmd,grunt,searx/static/themes/simple/gruntfile.js)
|
2020-03-26 17:00:07 +00:00
|
|
|
|
|
|
|
|
2020-03-25 13:50:39 +00:00
|
|
|
# docker
|
|
|
|
# ------
|
|
|
|
|
|
|
|
PHONY += docker
|
2020-03-30 10:23:01 +00:00
|
|
|
docker: buildenv
|
2020-03-25 13:50:39 +00:00
|
|
|
$(Q)./manage.sh docker_build
|
|
|
|
|
2020-03-31 09:59:54 +00:00
|
|
|
docker.push: buildenv
|
|
|
|
$(Q)./manage.sh docker_build push
|
|
|
|
|
2020-03-26 17:41:45 +00:00
|
|
|
# gecko
|
|
|
|
# -----
|
|
|
|
|
|
|
|
PHONY += gecko.driver
|
|
|
|
gecko.driver:
|
|
|
|
$(PY_ENV_ACT); ./manage.sh install_geckodriver
|
2020-03-25 13:50:39 +00:00
|
|
|
|
2021-01-26 10:46:36 +00:00
|
|
|
# search.checker
|
|
|
|
# --------------
|
|
|
|
|
|
|
|
search.checker: pyenvinstall
|
|
|
|
$(Q)$(PY_ENV_ACT); searx-checker -v
|
|
|
|
|
|
|
|
ENGINE_TARGETS=$(patsubst searx/engines/%.py,search.checker.%,$(wildcard searx/engines/[!_]*.py))
|
|
|
|
|
|
|
|
$(ENGINE_TARGETS): pyenvinstall
|
|
|
|
$(Q)$(PY_ENV_ACT); searx-checker -v "$(subst _, ,$(patsubst search.checker.%,%,$@))"
|
|
|
|
|
|
|
|
|
2019-11-28 19:05:29 +00:00
|
|
|
# test
|
|
|
|
# ----
|
|
|
|
|
2020-03-29 11:03:27 +00:00
|
|
|
PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot
|
2020-03-30 10:23:01 +00:00
|
|
|
test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot
|
2020-02-23 19:52:00 +00:00
|
|
|
|
2020-11-22 10:37:12 +00:00
|
|
|
PYLINT_FILES=\
|
|
|
|
searx/preferences.py \
|
|
|
|
searx/testing.py \
|
|
|
|
searx/engines/gigablast.py \
|
|
|
|
searx/engines/deviantart.py \
|
2021-01-22 17:49:45 +00:00
|
|
|
searx/engines/digg.py \
|
|
|
|
searx/engines/google.py \
|
2021-01-22 16:16:46 +00:00
|
|
|
searx/engines/google_news.py \
|
2021-01-26 10:46:36 +00:00
|
|
|
searx/engines/google_videos.py \
|
2021-02-09 12:08:01 +00:00
|
|
|
searx/engines/google_images.py \
|
2021-02-22 17:03:24 +00:00
|
|
|
searx/engines/mediathekviewweb.py \
|
2021-03-07 17:14:30 +00:00
|
|
|
searx/engines/solidtorrents.py \
|
2021-03-13 19:27:47 +00:00
|
|
|
searx/engines/solr.py \
|
2021-02-25 16:42:52 +00:00
|
|
|
searx/engines/google_scholar.py \
|
2021-03-08 08:41:32 +00:00
|
|
|
searx/engines/yahoo_news.py \
|
2021-03-09 07:34:57 +00:00
|
|
|
searx/engines/apkmirror.py \
|
2021-02-25 16:42:52 +00:00
|
|
|
searx_extra/update/update_external_bangs.py
|
2020-02-25 10:27:08 +00:00
|
|
|
|
2020-02-24 07:14:09 +00:00
|
|
|
test.pylint: pyenvinstall
|
2020-11-22 10:37:12 +00:00
|
|
|
$(call cmd,pylint,$(PYLINT_FILES))
|
2020-11-16 08:45:00 +00:00
|
|
|
$(call cmd,pylint,\
|
|
|
|
--disable=$(PYLINT_SEARX_DISABLE_OPTION) \
|
|
|
|
--additional-builtins=$(PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES) \
|
|
|
|
searx/engines \
|
|
|
|
)
|
|
|
|
$(call cmd,pylint,\
|
|
|
|
--disable=$(PYLINT_SEARX_DISABLE_OPTION) \
|
|
|
|
--ignore=searx/engines \
|
|
|
|
searx tests \
|
|
|
|
)
|
2020-03-26 17:41:45 +00:00
|
|
|
|
|
|
|
# ignored rules:
|
|
|
|
# E402 module level import not at top of file
|
|
|
|
# W503 line break before binary operator
|
2019-11-28 19:05:29 +00:00
|
|
|
|
2020-03-08 17:37:16 +00:00
|
|
|
# ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported!
|
2020-01-08 17:09:36 +00:00
|
|
|
test.sh:
|
2020-03-30 09:03:46 +00:00
|
|
|
shellcheck -x -s bash utils/brand.env
|
2020-01-08 17:13:22 +00:00
|
|
|
shellcheck -x utils/lib.sh
|
2020-01-08 18:21:07 +00:00
|
|
|
shellcheck -x utils/filtron.sh
|
2020-01-14 18:26:54 +00:00
|
|
|
shellcheck -x utils/searx.sh
|
2020-02-04 09:39:42 +00:00
|
|
|
shellcheck -x utils/morty.sh
|
2020-02-25 19:20:17 +00:00
|
|
|
shellcheck -x utils/lxc.sh
|
2020-03-07 19:24:08 +00:00
|
|
|
shellcheck -x utils/lxc-searx.env
|
2020-02-04 09:39:42 +00:00
|
|
|
shellcheck -x .config.sh
|
2020-01-08 17:09:36 +00:00
|
|
|
|
2019-11-28 19:05:29 +00:00
|
|
|
test.pep8: pyenvinstall
|
2020-11-06 00:40:21 +00:00
|
|
|
@echo "TEST pycodestyle (formerly pep8)"
|
2020-11-22 10:37:12 +00:00
|
|
|
$(Q)$(PY_ENV_ACT); pycodestyle --exclude='searx/static, searx/languages.py, $(foreach f,$(PYLINT_FILES),$(f),)' \
|
2020-11-06 10:54:53 +00:00
|
|
|
--max-line-length=120 --ignore "E117,E252,E402,E722,E741,W503,W504,W605" searx tests
|
2019-11-28 19:05:29 +00:00
|
|
|
|
|
|
|
test.unit: pyenvinstall
|
2020-03-26 17:41:45 +00:00
|
|
|
@echo "TEST tests/unit"
|
|
|
|
$(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
|
|
|
|
|
|
|
|
test.coverage: pyenvinstall
|
|
|
|
@echo "TEST unit test coverage"
|
|
|
|
$(Q)$(PY_ENV_ACT); \
|
|
|
|
python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
|
|
|
|
&& coverage report \
|
|
|
|
&& coverage html \
|
|
|
|
|
|
|
|
test.robot: pyenvinstall gecko.driver
|
|
|
|
@echo "TEST robot"
|
|
|
|
$(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
|
|
|
|
|
|
|
|
test.clean:
|
|
|
|
@echo "CLEAN intermediate test stuff"
|
|
|
|
$(Q)rm -rf geckodriver.log .coverage coverage/
|
2019-11-28 19:05:29 +00:00
|
|
|
|
2020-04-01 13:45:01 +00:00
|
|
|
|
|
|
|
# travis
|
|
|
|
# ------
|
|
|
|
|
2021-02-01 14:23:19 +00:00
|
|
|
PHONY += ci.test
|
|
|
|
ci.test:
|
|
|
|
$(PY_ENV_BIN)/python -c "import yaml" || make clean
|
|
|
|
$(MAKE) test
|
|
|
|
|
2020-04-01 13:45:01 +00:00
|
|
|
travis.codecov:
|
|
|
|
$(Q)$(PY_ENV_BIN)/python -m pip install codecov
|
|
|
|
|
2019-11-28 18:54:57 +00:00
|
|
|
.PHONY: $(PHONY)
|