From 148e9f17b9ba1c8d11296b97e128cd70facb2a7c Mon Sep 17 00:00:00 2001 From: Simon Prickett Date: Wed, 29 Dec 2021 19:08:46 +0000 Subject: [PATCH] Opened up Makefile to accept newer versions of Python than 3.8 --- Makefile | 22 ++++++++++++++++++---- README.md | 4 +++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a371fbb6..63bacda7 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,23 @@ APP := redisolar PORT := 8081 -PYTHON3_8 := $(shell command -v python3.8 2> /dev/null) +VALID_PYTHON_FOUND := $(shell command -v python3.8 2> /dev/null) +ifndef VALID_PYTHON_FOUND + VALID_PYTHON_FOUND := $(shell command -v python3.9 2> /dev/null) + PYTHON_COMMAND := "python3.9" +else + PYTHON_COMMAND := "python3.8" +endif +ifndef VALID_PYTHON_FOUND + VALID_PYTHON_FOUND := $(shell command -v python3.10 2> /dev/null) + PYTHON_COMMAND := "python3.10" +endif +ifndef VALID_PYTHON_FOUND + VALID_PYTHON_FOUND := $(shell command -v python3.11 2> /dev/null) + PYTHON_COMMAND := "python3.11" +endif -ifndef PYTHON3_8 - $(error "Python 3.8 is not installed! See README.md") +ifndef VALID_PYTHON_FOUND + $(error "Python 3.8-11 is not installed! See README.md") endif ifeq (${IS_CI}, true) @@ -19,7 +33,7 @@ all: env mypy lint test env: env/bin/activate env/bin/activate: requirements.txt - test -d env || python3.8 -m venv env + test -d env || ${PYTHON_COMMAND} -m venv env . env/bin/activate; pip install --upgrade pip; pip install pip-tools wheel -e .; pip-sync requirements.txt requirements-dev.txt touch env/bin/activate diff --git a/README.md b/README.md index 60aa8f12..e944fa1b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This is the sample application codebase for the Redis University course [RU102PY To start and run this application, you will need: -* [Python 3.8](https://www.python.org/downloads/) (**Note**: It must be version 3.8) +* [Python 3.8 or higher](https://www.python.org/downloads/) (**Note**: It must be version 3.8 or higher) * Access to a local or remote installation of [Redis](https://redis.io/download) version 5 or newer * Your Redis installation should have the RedisTimeSeries module installed. You can find the installation instructions at: https://oss.redis.com/redistimeseries/#setup @@ -44,6 +44,8 @@ following command from the base directory of the project: python3.8 -m venv env +Substitute `python3.8` for your version of Python if you're running Python 3.9 or 3.10. + #### Dependencies Before installing dependencies, activate the virtualenv: