summaryrefslogtreecommitdiff
path: root/utils/makefile.python
diff options
context:
space:
mode:
Diffstat (limited to 'utils/makefile.python')
-rw-r--r--utils/makefile.python41
1 files changed, 6 insertions, 35 deletions
diff --git a/utils/makefile.python b/utils/makefile.python
index 4aa9d6b49..f7e4315c1 100644
--- a/utils/makefile.python
+++ b/utils/makefile.python
@@ -26,7 +26,7 @@ PYLINT_RC ?= .pylintrc
TEST_FOLDER ?= ./tests
TEST ?= .
-VTENV_OPTS = "--no-site-packages"
+VTENV_OPTS ?=
PY_ENV = ./local/py$(PY)
PY_ENV_BIN = $(PY_ENV)/bin
PY_ENV_ACT = . $(PY_ENV_BIN)/activate
@@ -37,20 +37,6 @@ ifeq ($(OS),Windows_NT)
PY_ENV_ACT = $(PY_ENV_BIN)/activate
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::
@echo 'makefile.python:'
@echo ' pyenv | pyenv[un]install'
@@ -110,22 +96,6 @@ pip-exe:
@:
endif
-PHONY += msg-virtualenv-exe virtualenv-exe
-msg-virtualenv-exe:
- @echo "\n virtualenv is required\n\n\
- Make sure you have an updated virtualenv installed, grab it from\n\
- https://virtualenv.pypa.io/en/stable/installation/ or install it\n\
- via pip by::\n\n\
- pip install --user https://github.com/pypa/virtualenv/tarball/master\n" | $(FMT)
-
-ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 1)
-virtualenv-exe: msg-virtualenv-exe
- $(error The 'virtualenv' command was not found)
-else
-virtualenv-exe:
- @:
-endif
-
# ------------------------------------------------------------------------------
# commands
# ------------------------------------------------------------------------------
@@ -153,7 +123,7 @@ quiet_cmd_pyenvuninstall = PYENV uninstall $2
quiet_cmd_virtualenv = PYENV usage: $ source ./$@/bin/activate
cmd_virtualenv = \
if [ ! -d "./$(PY_ENV)" ];then \
- $(VIRTUALENV) $(VIRTUALENV_VERBOSE) $(VTENV_OPTS) $2; \
+ $(PYTHON) -m venv $(VTENV_OPTS) $2; \
else \
echo "PYENV using virtualenv from $2"; \
fi
@@ -192,7 +162,7 @@ quiet_cmd_pytest = TEST $@
# .. _installing: https://packaging.python.org/tutorials/installing-packages/
#
quiet_cmd_pybuild = BUILD $@
- cmd_pybuild = $(PY_ENV_BIN)/$(PYTHON) setup.py \
+ cmd_pybuild = $(PY_ENV_BIN)/python setup.py \
sdist -d $(PYDIST) \
bdist_wheel --bdist-dir $(PYBUILD) -d $(PYDIST)
@@ -232,8 +202,9 @@ pyclean:
# to build *local* environment, python and virtualenv from the OS is needed!
pyenv: $(PY_ENV)
-$(PY_ENV): virtualenv-exe python-exe
+$(PY_ENV): python-exe
$(call cmd,virtualenv,$(PY_ENV))
+ @$(PY_ENV_BIN)/pip install $(PIP_VERBOSE) -U wheel pip setuptools
@$(PY_ENV_BIN)/pip install $(PIP_VERBOSE) -r requirements.txt
PHONY += pylint-exe
@@ -284,7 +255,7 @@ pyenv-python: pyenv-install
# https://github.com/pypa/twine
PHONY += upload-pypi
-upload-pypi: pyclean pybuild
+upload-pypi: pyclean pyenvinstall pybuild
@$(PY_ENV_BIN)/twine upload $(PYDIST)/*
.PHONY: $(PHONY)