blob: 65e3fe4b93fd40dd7f546b8219aa3b376e0f0948 (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#!/bin/sh
#
# A script for unpacking and installing different historic versions of
# Python in a consistent manner for side-by-side development testing.
#
# This was written for a Linux system (specifically Ubuntu) but should
# be reasonably generic to any POSIX-style system with a /usr/local
# hierarchy.
USAGE="\
Usage: $0 [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...]
"
PRINT="echo"
EXECUTE="eval"
DOWNLOADS=Downloads
DOWNLOADS_URL=http://www.python.org/ftp/python
SUDO=sudo
PREFIX=/usr/local
while getopts "ad:hnq" FLAG; do
case ${FLAG} in
a )
ALL="1"
;;
d )
DOWNLOADS="${OPTARG}"
;;
h )
echo "${USAGE}"
exit 0
;;
n )
EXECUTE=":"
;;
p )
PREFIX="${OPTARG}"
;;
q )
PRINT=":"
;;
* )
echo "$0: unknown option ${FLAG}; use -h for help." >&2
exit 1
;;
esac
done
shift `expr ${OPTIND} - 1`
VERSIONS="$*"
if test "X${ALL}" != "X"; then
if test "${VERSIONS}"; then
msg="$0: -a and version arguments both specified on the command line"
echo "${msg}" >&2
exit 1
fi
VERSIONS="
1.5.2
2.0.1
2.1.3
2.2
2.3.6
2.4.4
"
# 2.5.1
fi
Command()
{
${PRINT} "$*"
ARGS=`echo "$*" | sed 's/\\$/\\\\$/'`
${EXECUTE} "$*"
}
for VERSION in $VERSIONS; do
DIR=`expr "$VERSION" : '\(...\)'`
PYTHON=Python-${VERSION}
TAR_GZ=${PYTHON}.tgz
if test ! -f ${DOWNLOADS}/${TAR_GZ}; then
if test ! -d ${DOWNLOADS}; then
Command mkdir ${DOWNLOADS}
fi
Command "( cd ${DOWNLOADS} && wget ${DOWNLOADS_URL}/${DIR}/${TAR_GZ} )"
fi
Command tar zxf ${DOWNLOADS}/${TAR_GZ}
(
Command cd ${PYTHON}
case ${VERSION} in
1.5* )
CONFIGUREFLAGS="--with-threads"
;;
1.6* | 2.0* )
# Add the zlib module so we get zipfile compression.
Command ed Modules/Setup.in <<EOF
/^#zlib/s/#//
w
q
EOF
CONFIGUREFLAGS="--with-threads"
;;
esac
Command ./configure --prefix=${PREFIX} ${CONFIGUREFLAGS} 2>&1 | tee configure.out
Command make 2>&1 | tee make.out
Command ${SUDO} make install
Command ${SUDO} rm -f ${PREFIX}/bin/{idle,pydoc,python,python-config,smtpd.py}
${PRINT} cd ..
)
Command rm -rf ${PYTHON}
done
|