2011-05-31 20:51:48 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2014-10-07 16:49:40 +00:00
|
|
|
case "$(uname -s)" in
|
|
|
|
Linux)
|
|
|
|
case "$(lsb_release --id --short)" in
|
|
|
|
Ubuntu|Debian)
|
2014-10-30 22:32:28 +00:00
|
|
|
for package in python-dev python-pip python-virtualenv libevent-dev python-libvirt libmysqlclient-dev; do
|
2014-10-07 16:49:40 +00:00
|
|
|
if [ "$(dpkg --status -- $package|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 packages, please install them:" 1>&2
|
|
|
|
echo "sudo apt-get install $missing"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
2014-10-28 01:08:43 +00:00
|
|
|
Fedora)
|
2014-10-30 22:32:09 +00:00
|
|
|
for package in python-pip python-virtualenv libevent-devel libvirt-python community-mysql-devel; do
|
2014-10-28 01:08:43 +00:00
|
|
|
if [ "$(rpm -q $package)" == "package $package is not installed" ]; then
|
|
|
|
missing="${missing:+$missing }$package"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$missing" ]; then
|
|
|
|
echo "$0: missing required packages, please install them:" 1>&2
|
|
|
|
echo "sudo yum install $missing"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2014-10-07 16:49:40 +00:00
|
|
|
*)
|
|
|
|
echo "This script does not support your Linux distribution yet. Patches encouraged!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
Darwin)
|
|
|
|
if ! which brew > /dev/null; then
|
|
|
|
echo "You need Homebrew: http://brew.sh/"
|
|
|
|
exit 1
|
2011-05-31 20:51:48 +00:00
|
|
|
fi
|
2014-10-07 16:49:40 +00:00
|
|
|
for keg in python libvirt libevent; do
|
|
|
|
if brew list $keg >/dev/null 2>&1; then
|
|
|
|
echo "Found $keg"
|
|
|
|
else
|
|
|
|
brew install keg
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "This script does not support your OS yet. Patches encouraged!"
|
2011-05-31 20:51:48 +00:00
|
|
|
exit 1
|
2014-10-07 16:49:40 +00:00
|
|
|
;;
|
|
|
|
esac
|
2011-05-31 20:51:48 +00:00
|
|
|
|
2013-08-22 23:02:22 +00:00
|
|
|
if [ -z "$NO_CLOBBER" ] || [ ! -e ./virtualenv ]; then
|
|
|
|
# site packages needed because libvirt python bindings are not nicely
|
|
|
|
# packaged
|
2014-08-29 01:13:37 +00:00
|
|
|
virtualenv --system-site-packages --setuptools virtualenv
|
2011-05-31 20:51:48 +00:00
|
|
|
|
2013-08-22 23:02:22 +00:00
|
|
|
# avoid pip bugs
|
|
|
|
./virtualenv/bin/pip install --upgrade pip
|
2014-01-03 18:41:11 +00:00
|
|
|
|
|
|
|
# work-around change in pip 1.5
|
|
|
|
./virtualenv/bin/pip install setuptools --no-use-wheel --upgrade
|
2013-08-22 23:02:22 +00:00
|
|
|
fi
|
2011-05-31 20:51:48 +00:00
|
|
|
|
|
|
|
./virtualenv/bin/pip install -r requirements.txt
|
|
|
|
|
2014-08-29 01:19:07 +00:00
|
|
|
./virtualenv/bin/python setup.py develop
|