File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,31 @@ test_github_webhook:
9898# # ======================
9999# # Misc
100100# # ======================
101-
101+ PROJECT := example-consumer-python
102+ PYTHON_MAJOR_VERSION := 3.11
103+ sgr0 := $(shell tput sgr0)
104+ red := $(shell tput setaf 1)
105+ green := $(shell tput setaf 2)
102106.env :
103107 touch .env
108+
109+
110+ venv :
111+ @if [ -d " ./.venv" ]; then echo " $( red) .venv already exists, not continuing!$( sgr0) " ; exit 1; fi
112+ @type pyenv > /dev/null 2>&1 || (echo " $( red) pyenv not found$( sgr0) " ; exit 1)
113+
114+ @echo "\n$(green)Try to find the most recent minor version of the major version specified$(sgr0)"
115+ $(eval PYENV_VERSION=$(shell pyenv install -l | grep "\s\s$(PYTHON_MAJOR_VERSION)\.*" | tail -1 | xargs))
116+ @echo "$(PYTHON_MAJOR_VERSION) -> $(PYENV_VERSION)"
117+
118+ @echo "\n$(green)Install the Python pyenv version if not already available$(sgr0)"
119+ pyenv install $(PYENV_VERSION) -s
120+
121+ @echo "\n$(green)Make a .venv dir$(sgr0)"
122+ ~/.pyenv/versions/${PYENV_VERSION}/bin/python3 -m venv ${CURDIR}/.venv
123+
124+ @echo "\n$(green)Make it 'available' to pyenv$(sgr0)"
125+ ln -sf ${CURDIR}/.venv ~/.pyenv/versions/${PROJECT}
126+
127+ @echo "\n$(green)Use it! (populate .python-version)$(sgr0)"
128+ pyenv local ${PROJECT}
You can’t perform that action at this time.
0 commit comments