From d85012b49b1d251cebb63ec1326bb946d0b5f6b8 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 24 Dec 2020 15:59:57 +0100 Subject: [PATCH 1/5] [perf] virtualenv: install boilerplate only once Install boilerplate packages (pip, wheel, setuptools and requirements.txt) only once, when virtualenv is created. Signed-off-by: Markus Heiser --- utils/makefile.python | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/makefile.python b/utils/makefile.python index c7f1e03e..0ae912b5 100644 --- a/utils/makefile.python +++ b/utils/makefile.python @@ -113,6 +113,8 @@ quiet_cmd_virtualenv = PYENV usage: $ source ./$@/bin/activate cmd_virtualenv = \ if [ ! -d "./$(PY_ENV)" ];then \ $(PYTHON) -m venv $(VTENV_OPTS) $2; \ + $(PY_ENV_BIN)/python -m pip install $(PIP_VERBOSE) -U pip wheel setuptools; \ + $(PY_ENV_BIN)/python -m pip install $(PIP_VERBOSE) -r requirements.txt; \ else \ echo "PYENV using virtualenv from $2"; \ fi @@ -193,8 +195,6 @@ pyclean: pyenv: $(PY_ENV) $(PY_ENV): python-exe $(call cmd,virtualenv,$(PY_ENV)) - $(Q)$(PY_ENV_BIN)/python -m pip install $(PIP_VERBOSE) -U pip wheel pip setuptools - $(Q)$(PY_ENV_BIN)/python -m pip install $(PIP_VERBOSE) -r requirements.txt PHONY += pylint-exe pylint-exe: $(PY_ENV) From 809bf85426812ece19bf1f19dff63a13d85099d6 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 24 Dec 2020 16:25:09 +0100 Subject: [PATCH 2/5] [perf] pyenvinstall: reinstall only when requirements are change Create a (PY_ENV)/requirements.sha256 file with sha256 sums of the ./requirements*.txt files and reinstall only if the sha256 sums change. Suggested-by: @dalf / https://github.com/searx/searx/pull/2418#pullrequestreview-558426579 Signed-off-by: Markus Heiser --- utils/makefile.python | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utils/makefile.python b/utils/makefile.python index 0ae912b5..eab9b20e 100644 --- a/utils/makefile.python +++ b/utils/makefile.python @@ -95,7 +95,13 @@ quiet_cmd_pyinstall = INSTALL $2 # $2 path to folder with setup.py, this uses pip from pyenv (not OS!) quiet_cmd_pyenvinstall = PYENV install $2 - cmd_pyenvinstall = $(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) install -e $2$(PY_SETUP_EXTRAS) + cmd_pyenvinstall = \ + if ! cat $(PY_ENV)/requirements.sha256 2>/dev/null | sha256sum --check --status 2>/dev/null; then \ + $(PY_ENV_BIN)/python -m pip $(PIP_VERBOSE) install -e $2$(PY_SETUP_EXTRAS) ;\ + sha256sum requirements*.txt > $(PY_ENV)/requirements.sha256 ;\ + else \ + echo "PYENV $2 already installed"; \ + fi # Uninstall the package. Since pip does not uninstall the no longer needed # depencies (something like autoremove) the depencies remain. From 6316a8d49a4c199b0859b5d860f127b49b580912 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 24 Dec 2020 23:17:21 +0100 Subject: [PATCH 3/5] [fix] message to install different python versions from apt PPA Signed-off-by: Markus Heiser --- utils/makefile.python | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/makefile.python b/utils/makefile.python index eab9b20e..42ad16d2 100644 --- a/utils/makefile.python +++ b/utils/makefile.python @@ -75,7 +75,9 @@ msg-python-exe: https://www.python.org 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)\n" | $(FMT) + sudo -H add-apt-repository ppa:deadsnakes/ppa\n\ + sudo -H apt update\n\ + sudo -H apt-get install $(PYTHON) $(PYTHON)-venv\n" ifeq ($(shell which $(PYTHON) >/dev/null 2>&1; echo $$?), 1) python-exe: msg-python-exe From bc7bd1d80a9113d5606bbfd18e96216373578647 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 26 Dec 2020 11:38:47 +0100 Subject: [PATCH 4/5] [fix] utils/lib.sh: various typos in messages and comments Signed-off-by: Markus Heiser --- utils/lib.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/lib.sh b/utils/lib.sh index 0d93138c..878e7df3 100755 --- a/utils/lib.sh +++ b/utils/lib.sh @@ -41,7 +41,7 @@ DOT_CONFIG="${DOT_CONFIG:-${REPO_ROOT}/.config.sh}" source_dot_config() { if [[ ! -e "${DOT_CONFIG}" ]]; then - err_msg "configuration does not extsts at: ${DOT_CONFIG}" + err_msg "configuration does not exists at: ${DOT_CONFIG}" return 42 fi # shellcheck disable=SC1090 @@ -159,7 +159,7 @@ clean_stdin() { } wait_key(){ - # usage: waitKEY [] + # usage: wait_key [] clean_stdin local _t=$1 @@ -639,7 +639,7 @@ nginx_distro_setup() { NGINX_DEFAULT_SERVER=/etc/nginx/nginx.conf # Including *location* directives from a dedicated config-folder into the - # server directive is, what what fedora and centos (already) does. + # server directive is, what fedora and centos (already) does. NGINX_APPS_ENABLED="/etc/nginx/default.d" # We add a apps-available folder and linking configurations into the @@ -692,7 +692,7 @@ nginx_reload() { nginx_install_app() { - # usage: nginx_install_app [