Make files - fallback to python(3.8) from PATH if .venv doesn't exist (#4863)

This commit is contained in:
jack1142
2021-02-28 15:39:28 +01:00
committed by GitHub
parent 1ff976b3d0
commit 9bb61ba882
3 changed files with 30 additions and 12 deletions

View File

@@ -4,6 +4,12 @@ PYTHON ?= python3.8
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
ifneq ($(wildcard $(ROOT_DIR)/.venv/.),)
VENV_PYTHON = $(ROOT_DIR)/.venv/bin/python
else
VENV_PYTHON = $(PYTHON)
endif
define HELP_BODY
Usage:
make <command>
@@ -25,11 +31,11 @@ export HELP_BODY
# Python Code Style
reformat:
$(PYTHON) -m black $(ROOT_DIR)
$(VENV_PYTHON) -m black $(ROOT_DIR)
stylecheck:
$(PYTHON) -m black --check $(ROOT_DIR)
$(VENV_PYTHON) -m black --check $(ROOT_DIR)
stylediff:
$(PYTHON) -m black --check --diff $(ROOT_DIR)
$(VENV_PYTHON) -m black --check --diff $(ROOT_DIR)
# Translations
gettext: