You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 lines
995 B

#!/bin/bash
set -eux # -x for verbose logging to juju debug-log
VERSION=${VERSION:-"2.7.9"}
##
## INSTALL Python
##
apt-get install wget bzip2 build-essential -y --force-yes
apt-get install libreadline-dev libbz2-dev libz-dev libssl-dev libsqlite3-dev libgdbm-dev libldap2-dev -y --force-yes
cd /tmp
wget http://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz
tar xzf Python-$VERSION.tgz
cd Python-$VERSION
./configure --prefix=/opt/apps/python-$VERSION
make
make install
##
## INSTALL DISTRIBUTE/PIP/VIRTUALENV
##
PYTHON_BASE="/opt/apps/python-$VERSION"
PYTHON_BIN="$PYTHON_BASE/bin"
cd /tmp
## XXXvlab: distribute seems dead.
# wget http://python-distribute.org/distribute_setup.py
# "$PYTHON_BIN"/python ./distribute_setup.py
wget https://bootstrap.pypa.io/get-pip.py
"$PYTHON_BIN"/python ./get-pip.py
"$PYTHON_BIN"/pip install virtualenv
##
## MAKE A DEFAULT VIRTUAL ENV
##
cd /srv
mkdir -p /srv/virtualenv
$PYTHON_BIN/virtualenv /srv/virtualenv/default --no-site-packages