-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-pythons.sh
36 lines (26 loc) · 1.12 KB
/
install-pythons.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -e -u -x
# construct package names from versions (python$VER-dev)
PYTHON_PACKAGES=`sed 's/[0-9.]\+/python\0-dev/g' <<< "$PYTHON_VERSIONS"`
echo "python versions: $PYTHON_VERSIONS ($PYTHON_PACKAGES)"
# get fkrull and pypy keys
export GNUPGHOME="$(mktemp -d)"
gpg --keyserver keyserver.ubuntu.com --recv-keys DB82666C
gpg --export DB82666C | apt-key add -
gpg --keyserver keyserver.ubuntu.com --recv-keys 68854915
gpg --export 68854915 | apt-key add -
# new repos for historical pythons and pypy
echo deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main >> /etc/apt/sources.list
echo deb-src http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main >> /etc/apt/sources.list
echo deb http://ppa.launchpad.net/pypy/ppa/ubuntu trusty main >> /etc/apt/sources.list
echo deb-src http://ppa.launchpad.net/pypy/ppa/ubuntu trusty main >> /etc/apt/sources.list
# update and install pythons and pypy
apt-get update
apt-get install -y \
$PYTHON_PACKAGES \
pypy-dev
# remove gpg stuff
rm -r "$GNUPGHOME"
# remove downloaded package files
# use apt-get update to re-download them
rm -rf /var/lib/apt/lists/*