-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·35 lines (28 loc) · 995 Bytes
/
setup.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
#!/bin/sh
. ./utils.sh || exit 1
unset PIP_REQUIRE_VIRTUALENV
# get major version number of default python
_test_executable "python" || exit 1
python_version="$(python -c 'import sys; print(sys.version_info.major)' 2>/dev/null)"
if [ -z "$python_version" ]; then
_print_error "Could not find major version number of default python"
exit 1
fi
# check that python 3's pip is in the system and get the name of its command
if [ "$python_version" = 3 ]; then
_test_executable "pip" || exit 1
pip_name="pip"
else
_test_executable "pip3" || exit 1
pip_name="pip3"
fi
printf "Installing or upgrading global python packages\n"
# upgrade python 3's default packages that come with pip
eval "$pip_name install --upgrade pip setuptools wheel" || exit
# install end-user python applications
_test_executable "pipx" || exit 1
pipx_packages=./python/pipx_packages.txt
_parse_text_file "$pipx_packages" \
| while read -r package options; do
eval "pipx install $options $package" || exit 1
done