-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-python.sh
executable file
·56 lines (41 loc) · 1.1 KB
/
install-python.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
umask 022
export TMPDIR="/scratch/$USER/tmp"
module purge
TMP="$(mktemp -d)"
BASEDIR=$(cd .. && pwd)
versions="3.9.14 3.9.15 3.9.16"
versions=3.9.16
for version in $versions
do
( # run in separate shell
shortversion=${version%.*}
prefix=$BASEDIR/install/python-$version
moduledirbase=$BASEDIR/modules/python
moduledir=$moduledirbase/$shortversion
# install python
true &&
cd $TMP &&
curl -LO https://www.python.org/ftp/python/$version/Python-$version.tgz &&
tar xzf Python-$version.tgz &&
cd Python-$version &&
./configure --prefix=$prefix &&
make -j 12 &&
make install &&
chmod -R a-w $prefix &&
chmod -R a+rX $prefix &&
rm -fr $TMP &&
mkdir -p $moduledir &&
touch $moduledirbase/.version &&
cat > $moduledir/$version << EOF
#%Module1.0##############################################
conflict python
conflict python3
module-whatis "Python $version"
prepend-path LD_LIBRARY_PATH $prefix/lib
prepend-path MANPATH $prefix/share/man
prepend-path PATH $prefix/bin
prepend-path PKG_CONFIG_PATH $prefix/lib/pkgconfig
module use $BASEDIR/add-modules/py$shortversion
EOF
)
done