Mercurial > hg > graal-compiler
comparison mxtool/mx @ 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 | 71a2cd79c375 |
children | 98918f518640 |
comparison
equal
deleted
inserted
replaced
8459:3393f870e6a4 | 8460:a607682f7ba6 |
---|---|
35 if [ ! -f "$dir/mx.py" ]; then | 35 if [ ! -f "$dir/mx.py" ]; then |
36 echo "Cannot find mx.py in $dir" | 36 echo "Cannot find mx.py in $dir" |
37 exit 1 | 37 exit 1 |
38 fi | 38 fi |
39 | 39 |
40 python <<END | 40 # Not all systems (e.g. Mac OS X) have 'python2' on the path. |
41 type python2.7 >/dev/null 2>&1 | |
42 if [ $? -eq 0 ]; then | |
43 python_exe=python2.7 | |
44 else | |
45 type python2 > /dev/null 2>&1 | |
46 if [ $? -eq 0]; then | |
47 python_exe=python2 | |
48 else | |
49 python_exe=python | |
50 fi | |
51 fi | |
52 | |
53 $python_exe <<END | |
41 import sys | 54 import sys |
42 major, minor, micro, _, _ = sys.version_info | 55 major, minor, micro, _, _ = sys.version_info |
43 if major != 2 or minor != 7: | 56 if major != 2 or minor != 7: |
44 raise SystemExit('The mx.py script requires Python 2.7, not {0}.{1}.{2}'.format(major, minor, micro)) | 57 raise SystemExit('The mx.py script requires Python 2.7, not {0}.{1}.{2}'.format(major, minor, micro)) |
45 END | 58 END |
46 if [ $? -eq 0 ]; then | 59 if [ $? -eq 0 ]; then |
47 exec python -u "$dir/mx.py" "$@" | 60 exec $python_exe -u "$dir/mx.py" "$@" |
48 fi | 61 fi |
49 | 62 |
50 #end of file | 63 #end of file |