File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-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) " ]; then
9
+ echo " Pyenv is available, switching local Python version to $PYTHON_VERSION "
10
+ pyenv install -fs " $PYTHON_VERSION "
11
+ pyenv local " $PYTHON_VERSION "
12
+ else
13
+ cat >&2 << EOF
14
+ Python $PYTHON_VERSION is not available. Aborting.
15
+ If your Linux distribution doesn't provide it, consider using Pyenv:
16
+ 1. Install Pyenv using your Linux distribution package manager
17
+ 2. Run the following commands:
18
+ pyenv install $PYTHON_VERSION
19
+ pyenv local $PYTHON_VERSION
20
+ For more information about pyenv, please visit https://github.com/pyenv/pyenv#readme
21
+ EOF
22
+ exit 1
23
+ fi
24
+ }
25
+
5
26
# Check if poetry is installed
6
27
command -v poetry > /dev/null 2>&1 || {
7
28
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