-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-hypermodern-env.sh
42 lines (35 loc) · 1.14 KB
/
install-hypermodern-env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Stop at first error
set -e -o pipefail
# Check arguments
script_name=`basename "${0}"`
python_versions="${*}"
tmp_chk_args=`echo "${python_versions}" | sed -e 's/^[ ]*//; s/[ ]*$//'`
if test "${tmp_chk_args}" = ""; then
echo "${script_name}: Error: Missing argument(s): Python version(s)" >&2
exit 1
fi
unset tmp_chk_args
# Install pyenv
curl -sSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
# Update the environment
. "${HOME}/load-hypermodern-env.sh"
# Install the desired versions of Python and their tooling
for version in ${python_versions}; do
pyenv install "${version}"
pyenv rehash
pyenv local "${version}"
pip install --upgrade pip
pip install --upgrade setuptools
pip install --upgrade wheel
pip install -c hypermodern-constraints.txt -r hypermodern-requirements.txt
poetry config virtualenvs.in-project true
done
pyenv local ${python_versions}
pyenv global ${python_versions}
# Make the environment always available
for rc_file in .bashrc .profile; do
echo '. "${HOME}/load-hypermodern-env.sh"' >>"${HOME}/${rc_file}"
done
# Report on the installed environments
pyenv global