From d85012b49b1d251cebb63ec1326bb946d0b5f6b8 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 24 Dec 2020 15:59:57 +0100 Subject: [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(-) (limited to 'utils/makefile.python') diff --git a/utils/makefile.python b/utils/makefile.python index c7f1e03ea..0ae912b5e 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) -- cgit v1.2.3 From 809bf85426812ece19bf1f19dff63a13d85099d6 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 24 Dec 2020 16:25:09 +0100 Subject: [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(-) (limited to 'utils/makefile.python') diff --git a/utils/makefile.python b/utils/makefile.python index 0ae912b5e..eab9b20e5 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. -- cgit v1.2.3 From 6316a8d49a4c199b0859b5d860f127b49b580912 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 24 Dec 2020 23:17:21 +0100 Subject: [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(-) (limited to 'utils/makefile.python') diff --git a/utils/makefile.python b/utils/makefile.python index eab9b20e5..42ad16d23 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 -- cgit v1.2.3