makefile.python: partial revert off 9b48ae47, adds py2 support back

revert "makefile.python: ... drop build support py2" to get back Py2 support.
TPy2 support need virtualenv installed by the OS.

BTW: log environment and python version in travis's install phase

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-04-01 17:21:26 +02:00
parent 31437d04e8
commit 09a4062505
2 changed files with 21 additions and 7 deletions

View File

@ -11,6 +11,7 @@ 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
@ -29,6 +30,8 @@ stages:
jobs: jobs:
include: include:
- python: "2.7"
env: PY=2
- python: "3.5" - python: "3.5"
- python: "3.6" - python: "3.6"
- stage: docker - stage: docker

View File

@ -30,7 +30,7 @@ PYLINT_RC ?= .pylintrc
TEST_FOLDER ?= ./tests TEST_FOLDER ?= ./tests
TEST ?= . TEST ?= .
VTENV_OPTS ?= VTENV_OPTS = "--no-site-packages"
PY_ENV = ./local/py$(PY) PY_ENV = ./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
@ -41,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'
@ -108,16 +122,13 @@ quiet_cmd_pyenvuninstall = PYENV uninstall $2
cmd_pyenvuninstall = $(PY_ENV_BIN)/python -m 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
# creating a virtualenv uses $(PYTHON) from the OS!
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 $@