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
|
2019-11-03 13:04:15 +00:00
|
|
|
packages=(which)
|
2013-07-24 18:10:36 +00:00
|
|
|
if [ -f /etc/debian_version ]; then
|
2019-11-03 13:04:15 +00:00
|
|
|
packages+=(python-pip python-virtualenv python-dev libevent-dev libffi-dev libxml2-dev libxslt-dev zlib1g-dev)
|
|
|
|
for package in ${packages[@]}; do
|
2013-07-10 01:15:25 +00:00
|
|
|
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
|
2015-05-15 17:15:33 +00:00
|
|
|
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
|
2019-11-03 13:04:15 +00:00
|
|
|
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"
|
Use non-broken version of setuptools, and fix bootstrap to be more portable.
Most recent version of setuptools breaks when asked to load requests 0.14.0.
symptom, complains about not being able to import filterfalse thus:
from six.moves import map, filter, filterfalse
this comes from setuptools, and older versions of setuptools don't have
this problem.
Various versions of centos7 and fedora have interesting names for packages,
centos7: python-pip is python2-pip
fedora24: python-virtualenv is python2-virtualenv
This is somewhat masked by using sudo yum: if the actual package
is installed, rpm knows that the capability is there and does nothing.
But, if the package isn't there, or you haven't chosen to set up
sudo to work that way, this does not work.
Signed-off-by: Marcus Watts <mwatts@redhat.com>
2017-01-26 08:26:55 +00:00
|
|
|
fi
|
|
|
|
fi
|
2019-11-03 13:04:15 +00:00
|
|
|
|
|
|
|
for package in ${packages[@]}; do
|
2013-07-10 01:15:25 +00:00
|
|
|
if [ "$(rpm -qa $package 2>/dev/null)" == "" ]; then
|
|
|
|
missing="${missing:+$missing }$package"
|
|
|
|
fi
|
|
|
|
done
|
2019-11-03 13:04:15 +00:00
|
|
|
|
2013-07-10 01:15:25 +00:00
|
|
|
if [ -n "$missing" ]; then
|
2015-05-15 17:15:33 +00:00
|
|
|
echo "$0: missing required RPM packages. Installing via sudo." 1>&2
|
|
|
|
sudo yum -y install $missing
|
2011-07-13 20:52:54 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-11-03 13:04:15 +00:00
|
|
|
${virtualenv} --python=$(which python2) --no-site-packages --distribute virtualenv
|
2011-07-13 20:52:54 +00:00
|
|
|
|
|
|
|
# avoid pip bugs
|
|
|
|
./virtualenv/bin/pip install --upgrade pip
|
|
|
|
|
Use non-broken version of setuptools, and fix bootstrap to be more portable.
Most recent version of setuptools breaks when asked to load requests 0.14.0.
symptom, complains about not being able to import filterfalse thus:
from six.moves import map, filter, filterfalse
this comes from setuptools, and older versions of setuptools don't have
this problem.
Various versions of centos7 and fedora have interesting names for packages,
centos7: python-pip is python2-pip
fedora24: python-virtualenv is python2-virtualenv
This is somewhat masked by using sudo yum: if the actual package
is installed, rpm knows that the capability is there and does nothing.
But, if the package isn't there, or you haven't chosen to set up
sudo to work that way, this does not work.
Signed-off-by: Marcus Watts <mwatts@redhat.com>
2017-01-26 08:26:55 +00:00
|
|
|
# slightly old version of setuptools; newer fails w/ requests 0.14.0
|
|
|
|
./virtualenv/bin/pip install setuptools==32.3.1
|
2014-01-10 03:09:39 +00:00
|
|
|
|
2011-04-04 21:45:42 +00:00
|
|
|
./virtualenv/bin/pip 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
|
2015-07-14 17:19:37 +00:00
|
|
|
./virtualenv/bin/python setup.py develop
|