fork 0k-charms
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

  1. #!/bin/bash
  2. set -eux # -x for verbose logging to juju debug-log
  3. VERSION=${VERSION:-"2.7.9"}
  4. ##
  5. ## INSTALL Python
  6. ##
  7. apt-get install wget bzip2 build-essential -y --force-yes
  8. apt-get install libreadline-dev libbz2-dev libz-dev libssl-dev libsqlite3-dev libgdbm-dev libldap2-dev -y --force-yes
  9. cd /tmp
  10. wget http://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz
  11. tar xzf Python-$VERSION.tgz
  12. cd Python-$VERSION
  13. ./configure --prefix=/opt/apps/python-$VERSION
  14. make
  15. make install
  16. ##
  17. ## INSTALL DISTRIBUTE/PIP/VIRTUALENV
  18. ##
  19. PYTHON_BASE="/opt/apps/python-$VERSION"
  20. PYTHON_BIN="$PYTHON_BASE/bin"
  21. cd /tmp
  22. ## XXXvlab: distribute seems dead.
  23. # wget http://python-distribute.org/distribute_setup.py
  24. # "$PYTHON_BIN"/python ./distribute_setup.py
  25. wget https://bootstrap.pypa.io/get-pip.py
  26. "$PYTHON_BIN"/python ./get-pip.py
  27. "$PYTHON_BIN"/pip install virtualenv
  28. ##
  29. ## MAKE A DEFAULT VIRTUAL ENV
  30. ##
  31. cd /srv
  32. mkdir -p /srv/virtualenv
  33. $PYTHON_BIN/virtualenv /srv/virtualenv/default --no-site-packages