forked from easybuilders/easybuild-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eb
executable file
·90 lines (79 loc) · 3.11 KB
/
eb
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
#!/bin/bash
##
# Copyright 2009-2014 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# http://github.com/hpcugent/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
# EasyBuild main script
# find location of main EasyBuild script by looking in Python search path, and run it
# this is an alternative for "python -m easybuild.main $@" which has issues, i.e.
# * it doesn't work with Python 2.4 (which we hang on to because of it being the default version in RedHat v5)
# * an ugly warning is printed whenever the pkg_resources module is loaded (e.g. by 3rd party modules like pygraph),
# see http://bugs.python.org/setuptools/issue36
# the cause of this is probably that we spread out the easybuild namespace across different locations
# @author: Stijn De Weirdt (Ghent University)
# @author: Dries Verdegem (Ghent University)
# @author: Kenneth Hoste (Ghent University)
# @author: Pieter De Baets (Ghent University)
# @author: Jens Timmerman (Ghent University)
# Python 2.6 or more recent 2.x required
REQ_MAJ_PYVER=2
REQ_MIN_PYVER=6
REQ_PYVER=${REQ_MAJ_PYVER}.${REQ_MIN_PYVER}
PYTHON=python$REQ_MAJ_PYVER
which $PYTHON &> /dev/null
if [ $? -ne 0 ]
then
PYTHON=python
which $PYTHON &> /dev/null
if [ $? -ne 0 ]
then
echo "ERROR: $PYTHON not available in \$PATH?"
exit 1
fi
fi
# make sure Python version being used is compatible
pyver=`$PYTHON -V 2>&1 | cut -f2 -d' '`
pyver_maj=`echo $pyver | cut -f1 -d'.'`
pyver_min=`echo $pyver | cut -f2 -d'.'`
if [ $pyver_maj -ne $REQ_MAJ_PYVER ]
then
echo "ERROR: EasyBuild is currently only compatible with Python v${REQ_MAJ_PYVER}.x, found v${pyver}" 1>&2
exit 2
fi
if [ $pyver_min -lt $REQ_MIN_PYVER ]
then
echo "ERROR: EasyBuild requires Python v${REQ_PYVER} or a more recent v${REQ_MAJ_PYVER}.x, found v${pyver}." 1>&2
exit 3
fi
# enable optimization, unless $PYTHONOPTIMIZE is defined (use "export PYTHONOPTIMIZE=0" to disable optimization)
if [ -z $PYTHONOPTIMIZE ]
then
# instruct Python to turn on basic optimizations (equivalent to using 'python -O')
export PYTHONOPTIMIZE=1
fi
if [ -z $FANCYLOGGER_IGNORE_MPI4PY ]
then
# avoid that fancylogger tries to import mpi4py to determine MPI rank
export FANCYLOGGER_IGNORE_MPI4PY=1
fi
$PYTHON -m easybuild.main "$@"