github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/builtin/scriptpack/python/data/install.sh (about)

     1  # python_install_prepare should be called before any installation is done.
     2  python_install_prepare() {
     3    # Obvious: we're running non-interactive mode
     4    export DEBIAN_FRONTEND=noninteractive
     5  
     6    # Update apt once
     7    apt_update_once
     8  
     9    # Our PPAs have unicode characters, so we need to set the proper lang.
    10    otto_init_locale
    11  
    12    oe sudo apt-get install -y python-software-properties software-properties-common \
    13        apt-transport-https wget
    14  }
    15  
    16  # python_install installs an arbitrary Python version given in the argument.
    17  #
    18  # The python version must be two sections, ex. "2.4", "2.7"
    19  python_install() {
    20      local version="$1"
    21      case $version in
    22      2.3)
    23          _python_install_raw "2.3"
    24          ;;
    25      2.4)
    26          _python_install_raw "2.4"
    27          ;;
    28      2.5)
    29          _python_install_raw "2.5"
    30          ;;
    31      2.6)
    32          _python_install_raw "2.6"
    33          ;;
    34      2.7)
    35          _python_install_raw "2.7"
    36          ;;
    37      3.1)
    38          _python_install_raw "3.1"
    39          ;;
    40      3.2)
    41          _python_install_raw "3.2"
    42          ;;
    43      3.3)
    44          _python_install_raw "3.3"
    45          ;;
    46      *)
    47          echo "Unknown Python version: ${version}" >&2
    48          exit 1
    49          ;;
    50      esac
    51  }
    52  
    53  _python_install_raw() {
    54      local version="$1"
    55  
    56      # Install Python proper
    57      python_install_prepare
    58      apt_install python${version} python${version}-dev
    59  
    60      # Install pip
    61      wget -q -O - https://bootstrap.pypa.io/get-pip.py | oe sudo python${version}
    62  
    63      # Install virtualenv
    64      oe sudo pip install virtualenv
    65  }