File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
+ # Check if the required Python version is available
6
+ PYTHON_VERSION=$( grep -oP ' python\s*=\s*"[^0-9]*\K[0-9]+\.[0-9]+' pyproject.toml)
7
+ command -v " python$PYTHON_VERSION " > /dev/null 2>&1 || {
8
+ if [ " $( command -v pyenv > /dev/null 2>&1 ) " ]; then
9
+ echo " Pyenv is available, switching local Python version to $PYTHON_VERSION "
10
+ if [ ! " $( pyenv local " $PYTHON_VERSION " ) " ]; then
11
+ echo " Python $PYTHON_VERSION is not available, installing Python $PYTHON_VERSION "
12
+ pyenv install " $PYTHON_VERSION "
13
+
14
+ echo " Setting local Python version to $PYTHON_VERSION "
15
+ pyenv local " $PYTHON_VERSION "
16
+ fi
17
+ else
18
+ cat >&2 << EOF
19
+ Python $PYTHON_VERSION is not available. Aborting.
20
+ If your Linux distribution doesn't provide it, consider using Pyenv:
21
+ 1. Install Pyenv using your Linux distribution package manager
22
+ 2. Run the following commands:
23
+ pyenv install $PYTHON_VERSION
24
+ pyenv local $PYTHON_VERSION
25
+ For more information about pyenv, please visit https://github.com/pyenv/pyenv#readme
26
+ EOF
27
+ exit 1
28
+ fi
29
+ }
30
+
5
31
# Check if poetry is installed
6
32
command -v poetry > /dev/null 2>&1 || {
7
33
echo >&2 " poetry is not installed. Aborting. Please install it and try again."
You can’t perform that action at this time.
0 commit comments