2019-12-07 09:23:03 +00:00
|
|
|
#!/bin/bash
|
2011-04-04 21:45:42 +00:00
|
|
|
set -e
|
2011-07-13 20:52:54 +00:00
|
|
|
|
2019-11-03 13:04:15 +00:00
|
|
|
virtualenv="virtualenv"
|
2019-11-24 23:04:42 +00:00
|
|
|
declare -a packages
|
2020-01-15 19:34:17 +00:00
|
|
|
source /etc/os-release
|
|
|
|
|
|
|
|
case "$ID" in
|
|
|
|
debian|ubuntu|devuan)
|
|
|
|
packages=(debianutils python3-pip python3-virtualenv python3-dev libevent-dev libffi-dev libxml2-dev libxslt-dev zlib1g-dev)
|
|
|
|
for package in ${packages[@]}; do
|
|
|
|
if [ "$(dpkg --status -- $package 2>/dev/null|sed -n 's/^Status: //p')" != "install ok installed" ]; then
|
|
|
|
# add a space after old values
|
|
|
|
missing="${missing:+$missing }$package"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$missing" ]; then
|
|
|
|
echo "$0: missing required DEB packages. Installing via sudo." 1>&2
|
|
|
|
sudo apt-get -y install $missing
|
2013-07-10 01:15:25 +00:00
|
|
|
fi
|
2020-01-15 19:34:17 +00:00
|
|
|
;;
|
|
|
|
centos|fedora|rhel|ol|virtuozzo)
|
|
|
|
|
2024-07-16 12:09:44 +00:00
|
|
|
packages=(which python3-virtualenv python3-devel libevent-devel libffi-devel libxml2-devel libxslt-devel zlib-devel)
|
2020-01-15 19:34:17 +00:00
|
|
|
for package in ${packages[@]}; do
|
|
|
|
if [ "$(rpm -qa $package 2>/dev/null)" == "" ]; then
|
|
|
|
missing="${missing:+$missing }$package"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$missing" ]; then
|
|
|
|
echo "$0: Missing required RPM packages: ${missing}." 1>&2
|
|
|
|
sudo yum -y install $missing
|
2019-03-22 17:58:30 +00:00
|
|
|
fi
|
2020-01-15 19:34:17 +00:00
|
|
|
;;
|
|
|
|
opensuse*|suse|sles)
|
|
|
|
|
|
|
|
packages=(which python3-virtualenv python3-devel libev-devel libffi-devel libxml2-devel libxslt-devel zlib-devel)
|
|
|
|
for package in ${packages[@]}; do
|
|
|
|
if [ "$(rpm -qa $package 2>/dev/null)" == "" ]; then
|
|
|
|
missing="${missing:+$missing }$package"
|
|
|
|
fi
|
|
|
|
if [ -n "$missing" ]; then
|
|
|
|
echo "$0: Missing required RPM packages: ${missing}." 1>&2
|
|
|
|
sudo zypper --non-interactive install --no-recommends $missing
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Bootstrap script does not support this distro yet, consider adding the packages"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
2011-07-13 20:52:54 +00:00
|
|
|
|
2019-03-22 17:58:30 +00:00
|
|
|
# s3-tests only works on python 3.6 not newer versions of python3
|
2020-05-21 14:48:34 +00:00
|
|
|
${virtualenv} --python=$(which python3.6) virtualenv
|
2011-07-13 20:52:54 +00:00
|
|
|
|
|
|
|
# avoid pip bugs
|
2019-03-22 17:58:30 +00:00
|
|
|
./virtualenv/bin/pip3 install --upgrade pip
|
2011-07-13 20:52:54 +00:00
|
|
|
|
2020-05-25 04:48:19 +00:00
|
|
|
# latest setuptools supporting python 2.7
|
|
|
|
./virtualenv/bin/pip install setuptools==44.1.0
|
2014-01-10 03:09:39 +00:00
|
|
|
|
2019-03-22 17:58:30 +00:00
|
|
|
./virtualenv/bin/pip3 install -r requirements.txt
|
2011-07-13 20:52:54 +00:00
|
|
|
|
|
|
|
# forbid setuptools from using the network because it'll try to use
|
|
|
|
# easy_install, and we really wanted pip; next line will fail if pip
|
|
|
|
# requirements.txt does not match setup.py requirements -- sucky but
|
|
|
|
# good enough for now
|
2019-03-22 17:58:30 +00:00
|
|
|
./virtualenv/bin/python3 setup.py develop
|