Mercurial > hg > graal-compiler
changeset 8460:a607682f7ba6
mx.sh should select python2.7 python2 or python depending on what is available.
Originaly contributed by Matthias Grimmer
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 25 Mar 2013 11:27:40 +0100 |
parents | 3393f870e6a4 |
children | 6a8ad083746e |
files | mxtool/mx |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mxtool/mx Mon Mar 25 11:08:50 2013 +0100 +++ b/mxtool/mx Mon Mar 25 11:27:40 2013 +0100 @@ -37,14 +37,27 @@ exit 1 fi -python <<END +# Not all systems (e.g. Mac OS X) have 'python2' on the path. +type python2.7 >/dev/null 2>&1 +if [ $? -eq 0 ]; then + python_exe=python2.7 +else + type python2 > /dev/null 2>&1 + if [ $? -eq 0]; then + python_exe=python2 + else + python_exe=python + fi +fi + +$python_exe <<END import sys major, minor, micro, _, _ = sys.version_info if major != 2 or minor != 7: raise SystemExit('The mx.py script requires Python 2.7, not {0}.{1}.{2}'.format(major, minor, micro)) END if [ $? -eq 0 ]; then - exec python -u "$dir/mx.py" "$@" + exec $python_exe -u "$dir/mx.py" "$@" fi #end of file