mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-25 03:47:22 +00:00
e7fbcee0d5
Use of declare that is bash specific was introduced in: d44c923405e22ea8b6cc1ab4316be3cc07f29b5 Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
60 lines
2.1 KiB
Bash
Executable file
60 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
virtualenv="virtualenv"
|
|
declare -a packages
|
|
packages=(which)
|
|
if [ -f /etc/debian_version ]; then
|
|
packages+=(python-pip python-virtualenv python-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
|
|
fi
|
|
else
|
|
packages+=(libevent-devel libffi-devel libxml2-devel libxslt-devel zlib-devel)
|
|
if [ -f /etc/fedora-release ]; then
|
|
packages+=(python2-pip python2-virtualenv python2-devel)
|
|
elif [ -f /etc/redhat-release ]; then
|
|
unset ${GREP_OPTIONS}
|
|
eval $(cat /etc/os-release | grep VERSION_ID)
|
|
if [ ${VERSION_ID:0:1} -lt 8 ]; then
|
|
packages+=(python-virtualenv python-devel)
|
|
else
|
|
packages+=(python2-virtualenv python2-devel)
|
|
virtualenv="virtualenv-2"
|
|
fi
|
|
fi
|
|
|
|
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. Installing via sudo." 1>&2
|
|
sudo yum -y install $missing
|
|
fi
|
|
fi
|
|
|
|
${virtualenv} --python=$(which python2) --no-site-packages --distribute virtualenv
|
|
|
|
# avoid pip bugs
|
|
./virtualenv/bin/pip install --upgrade pip
|
|
|
|
# slightly old version of setuptools; newer fails w/ requests 0.14.0
|
|
./virtualenv/bin/pip install setuptools==32.3.1
|
|
|
|
./virtualenv/bin/pip install -r requirements.txt
|
|
|
|
# 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
|
|
./virtualenv/bin/python setup.py develop
|