Merge branch 'master' of https://github.com/asciimoo/searx into filtron

This commit is contained in:
Markus Heiser 2020-04-02 18:59:43 +02:00
commit 2441e24288
4 changed files with 51 additions and 40 deletions

View File

@ -1,21 +1,19 @@
os: linux os: linux
dist: bionic dist: bionic
arch: arm64
language: python language: python
cache: cache:
- directories: - directories:
- $HOME/.cache/pip - $HOME/.cache/pip
before_cache:
- sudo chown -R travis:travis $HOME/.cache/pip
- rm -f $HOME/.cache/pip/log/debug.log
addons: addons:
firefox: "latest" firefox: "latest"
install: install:
- env
- which python; python --version
- make V=1 install - make V=1 install
- make V=1 gecko.driver - make V=1 gecko.driver
- make V=1 node.env - make V=1 node.env
- local/py3/bin/pip install codecov - make V=1 travis.codecov
script: script:
- make V=1 themes - make V=1 themes
- make V=1 test - make V=1 test
@ -31,6 +29,7 @@ stages:
jobs: jobs:
include: include:
- python: "2.7" - python: "2.7"
env: PY=2
- python: "3.5" - python: "3.5"
- python: "3.6" - python: "3.6"
- stage: docker - stage: docker

View File

@ -210,6 +210,10 @@ gecko.driver:
PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot
test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot
ifeq ($(PY),2)
test.pylint:
@echo "LINT skip liniting py2"
else
# TODO: balance linting with pylint # TODO: balance linting with pylint
test.pylint: pyenvinstall test.pylint: pyenvinstall
@ -217,6 +221,7 @@ test.pylint: pyenvinstall
searx/preferences.py \ searx/preferences.py \
searx/testing.py \ searx/testing.py \
) )
endif
# ignored rules: # ignored rules:
# E402 module level import not at top of file # E402 module level import not at top of file
@ -256,4 +261,11 @@ test.clean:
@echo "CLEAN intermediate test stuff" @echo "CLEAN intermediate test stuff"
$(Q)rm -rf geckodriver.log .coverage coverage/ $(Q)rm -rf geckodriver.log .coverage coverage/
# travis
# ------
travis.codecov:
$(Q)$(PY_ENV_BIN)/python -m pip install codecov
.PHONY: $(PHONY) .PHONY: $(PHONY)

View File

@ -121,8 +121,9 @@ docker_build() {
SEARX_GIT_VERSION=$(git describe --match "v[0-9]*\.[0-9]*\.[0-9]*" HEAD 2>/dev/null | awk -F'-' '{OFS="-"; $1=substr($1, 2); $3=substr($3, 2); print}') SEARX_GIT_VERSION=$(git describe --match "v[0-9]*\.[0-9]*\.[0-9]*" HEAD 2>/dev/null | awk -F'-' '{OFS="-"; $1=substr($1, 2); $3=substr($3, 2); print}')
# add the suffix "-dirty" if the repository has uncommited change # add the suffix "-dirty" if the repository has uncommited change
# /!\ HACK for searx/searx: ignore searx/brand.py and utils/brand.env
git update-index -q --refresh git update-index -q --refresh
if [ ! -z "$(git diff-index --name-only HEAD --)" ]; then if [ ! -z "$(git diff-index --name-only HEAD -- | grep -v 'searx/brand.py' | grep -v 'utils/brand.env')" ]; then
SEARX_GIT_VERSION="${SEARX_GIT_VERSION}-dirty" SEARX_GIT_VERSION="${SEARX_GIT_VERSION}-dirty"
fi fi

View File

@ -12,9 +12,12 @@ PYDIST = ./$(LXC_ENV_FOLDER)dist
# folder where the python intermediate build files take place # folder where the python intermediate build files take place
PYBUILD = ./$(LXC_ENV_FOLDER)build PYBUILD = ./$(LXC_ENV_FOLDER)build
# python version to use # python version to use
PY =3 PY ?=3
PYTHON = python$(PY) # $(PYTHON) points to the python interpreter from the OS! The python from the
PIP = pip$(PY) # OS is needed e.g. to create a virtualenv. For tasks inside the virtualenv the
# interpeter from '$(PY_ENV_BIN)/python' is used.
PYTHON ?= python$(PY)
PIP ?= pip$(PY)
PIP_INST ?= --user PIP_INST ?= --user
# https://www.python.org/dev/peps/pep-0508/#extras # https://www.python.org/dev/peps/pep-0508/#extras
@ -27,7 +30,7 @@ PYLINT_RC ?= .pylintrc
TEST_FOLDER ?= ./tests TEST_FOLDER ?= ./tests
TEST ?= . TEST ?= .
VTENV_OPTS ?= VTENV_OPTS = "--no-site-packages"
PY_ENV = ./$(LXC_ENV_FOLDER)local/py$(PY) PY_ENV = ./$(LXC_ENV_FOLDER)local/py$(PY)
PY_ENV_BIN = $(PY_ENV)/bin PY_ENV_BIN = $(PY_ENV)/bin
PY_ENV_ACT = . $(PY_ENV_BIN)/activate PY_ENV_ACT = . $(PY_ENV_BIN)/activate
@ -38,6 +41,20 @@ ifeq ($(OS),Windows_NT)
PY_ENV_ACT = $(PY_ENV_BIN)/activate PY_ENV_ACT = $(PY_ENV_BIN)/activate
endif endif
ifeq ($(PYTHON),python)
VIRTUALENV = virtualenv
else
VIRTUALENV = virtualenv --python=$(PYTHON)
endif
ifeq ($(KBUILD_VERBOSE),1)
PIP_VERBOSE =
VIRTUALENV_VERBOSE =
else
PIP_VERBOSE = "-q"
VIRTUALENV_VERBOSE = "-q"
endif
python-help:: python-help::
@echo 'makefile.python:' @echo 'makefile.python:'
@echo ' pyenv | pyenv[un]install' @echo ' pyenv | pyenv[un]install'
@ -81,22 +98,6 @@ python-exe:
@: @:
endif endif
msg-pip-exe:
@echo "\n $(PIP) is required\n\n\
Make sure you have updated pip installed, grab it from\n\
https://pip.pypa.io or install it from your package\n\
manager. On debian based OS these requirements are\n\
installed by::\n\n\
sudo -H apt-get install python$(PY)-pip\n" | $(FMT)
ifeq ($(shell which $(PIP) >/dev/null 2>&1; echo $$?), 1)
pip-exe: msg-pip-exe
$(error The '$(PIP)' command was not found)
else
pip-exe:
@:
endif
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# commands # commands
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -107,9 +108,9 @@ quiet_cmd_pyinstall = INSTALL $2
# $2 path to folder with setup.py, this uses pip from pyenv (not OS!) # $2 path to folder with setup.py, this uses pip from pyenv (not OS!)
quiet_cmd_pyenvinstall = PYENV install $2 quiet_cmd_pyenvinstall = PYENV install $2
cmd_pyenvinstall = $(PY_ENV_BIN)/pip $(PIP_VERBOSE) install -e $2$(PY_SETUP_EXTRAS) cmd_pyenvinstall = $(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) install -e $2$(PY_SETUP_EXTRAS)
# Uninstall the package. Since pip does not uninstall the no longer needed # Uninstall the package. Since pip does not uninstall the no longer needed
# depencies (something like autoremove) the depencies remain. # depencies (something like autoremove) the depencies remain.
# $2 package name to uninstall, this uses pip from the OS. # $2 package name to uninstall, this uses pip from the OS.
@ -118,25 +119,23 @@ quiet_cmd_pyuninstall = UNINSTALL $2
# $2 path to folder with setup.py, this uses pip from pyenv (not OS!) # $2 path to folder with setup.py, this uses pip from pyenv (not OS!)
quiet_cmd_pyenvuninstall = PYENV uninstall $2 quiet_cmd_pyenvuninstall = PYENV uninstall $2
cmd_pyenvuninstall = $(PY_ENV_BIN)/pip $(PIP_VERBOSE) uninstall --yes $2 cmd_pyenvuninstall = $(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) uninstall --yes $2
# $2 path to folder where virtualenv take place # $2 path to folder where virtualenv take place
quiet_cmd_virtualenv = PYENV usage: $ source ./$@/bin/activate quiet_cmd_virtualenv = PYENV usage: $ source ./$@/bin/activate
cmd_virtualenv = \ cmd_virtualenv = \
if [ ! -d "$(PY_ENV)" ];then \ if [ ! -d "./$(PY_ENV)" ];then \
echo "PYENV create virtualenv $2"; \ $(VIRTUALENV) $(VIRTUALENV_VERBOSE) $(VTENV_OPTS) $2; \
$(PYTHON) -m venv $(VTENV_OPTS) $2; \
else \ else \
echo "PYENV using virtualenv from $2"; \ echo "PYENV using virtualenv from $2"; \
fi; \ fi
echo "commands available at $(PY_ENV_BIN):"; ls $(PY_ENV_BIN) | $(FMT) ;
# $2 path to lint # $2 path to lint
quiet_cmd_pylint = LINT $@ quiet_cmd_pylint = LINT $@
cmd_pylint = $(PY_ENV_BIN)/pylint --rcfile $(PYLINT_RC) $2 cmd_pylint = $(PY_ENV_BIN)/python -m pylint --rcfile $(PYLINT_RC) $2
quiet_cmd_pytest = TEST $@ quiet_cmd_pytest = TEST $@
cmd_pytest = $(PY_ENV_BIN)/tox -vv cmd_pytest = $(PY_ENV_BIN)/python -m tox -vv
# setuptools, pip, easy_install its a mess full of cracks, a documentation hell # setuptools, pip, easy_install its a mess full of cracks, a documentation hell
# and broken by design ... all sucks, I really, really hate all this ... aaargh! # and broken by design ... all sucks, I really, really hate all this ... aaargh!
@ -203,7 +202,7 @@ PHONY += pyclean
pyclean: pyclean:
$(call cmd,pyclean) $(call cmd,pyclean)
# to build *local* environment, python and virtualenv from the OS is needed! # to build *local* environment, python from the OS is needed!
pyenv: $(PY_ENV) pyenv: $(PY_ENV)
$(PY_ENV): python-exe $(PY_ENV): python-exe
$(call cmd,virtualenv,$(PY_ENV)) $(call cmd,virtualenv,$(PY_ENV))
@ -212,7 +211,7 @@ $(PY_ENV): python-exe
PHONY += pylint-exe PHONY += pylint-exe
pylint-exe: $(PY_ENV) pylint-exe: $(PY_ENV)
@$(PY_ENV_BIN)/pip $(PIP_VERBOSE) install pylint @$(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) install pylint
PHONY += pylint PHONY += pylint
pylint: pylint-exe pylint: pylint-exe
@ -236,11 +235,11 @@ pydebug: $(PY_ENV)
# install / uninstall python objects into virtualenv (PYENV) # install / uninstall python objects into virtualenv (PYENV)
pyenv-install: $(PY_ENV) pyenv-install: $(PY_ENV)
@$(PY_ENV_BIN)/pip $(PIP_VERBOSE) install -e . @$(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) install -e .
@echo "ACTIVATE $(call normpath,$(PY_ENV_ACT)) " @echo "ACTIVATE $(call normpath,$(PY_ENV_ACT)) "
pyenv-uninstall: $(PY_ENV) pyenv-uninstall: $(PY_ENV)
@$(PY_ENV_BIN)/pip $(PIP_VERBOSE) uninstall --yes . @$(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) uninstall --yes .
# runs python interpreter from ./local/py<N>/bin/python # runs python interpreter from ./local/py<N>/bin/python
pyenv-python: pyenv-install pyenv-python: pyenv-install