fix: update regex to get supported python versions (#4175)
* fix: update regex to get supported python versions * chore: move version check to bash script
This commit is contained in:
parent
e8e226c0dc
commit
7dd85ac0fe
2 changed files with 27 additions and 18 deletions
7
Makefile
7
Makefile
|
|
@ -6,7 +6,7 @@ DOCKERFILE=docker/build_and_push.Dockerfile
|
|||
DOCKERFILE_BACKEND=docker/build_and_push_backend.Dockerfile
|
||||
DOCKERFILE_FRONTEND=docker/frontend/build_and_push_frontend.Dockerfile
|
||||
DOCKER_COMPOSE=docker_example/docker-compose.yml
|
||||
PYTHON_REQUIRED=$(shell grep '^python[[:space:]]*=' pyproject.toml | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||
PYTHON_REQUIRED=$(shell grep '^requires-python[[:space:]]*=' pyproject.toml | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||
RED=\033[0;31m
|
||||
NC=\033[0m # No Color
|
||||
GREEN=\033[0;32m
|
||||
|
|
@ -44,10 +44,7 @@ check_tools:
|
|||
# check if Python version is compatible
|
||||
check_env: ## check if Python version is compatible
|
||||
@chmod +x scripts/setup/check_env.sh
|
||||
@PYTHON_INSTALLED=$$(scripts/setup/check_env.sh python --version 2>&1 | awk '{print $$2}'); \
|
||||
if ! scripts/setup/check_env.sh python -c "import sys; from packaging.specifiers import SpecifierSet; from packaging.version import Version; sys.exit(not SpecifierSet('$(PYTHON_REQUIRED)').contains(Version('$$PYTHON_INSTALLED')))" 2>/dev/null; then \
|
||||
echo "$(RED)Error: Python version $$PYTHON_INSTALLED is not compatible with the required version $(PYTHON_REQUIRED). Aborting.$(NC)"; exit 1; \
|
||||
fi
|
||||
@scripts/setup/check_env.sh "$(PYTHON_REQUIRED)"
|
||||
|
||||
help: ## show this help message
|
||||
@echo '----'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue