Mercurial > hg > graal-jvmci-8
diff mxtool/mx.py @ 17012:ad10671d1bbd
mx: move get_arch() to mxtool
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Tue, 02 Sep 2014 14:45:51 +0200 |
parents | 7dbe1207fccf |
children | 0b2675391d01 |
line wrap: on
line diff
--- a/mxtool/mx.py Tue Sep 02 10:30:28 2014 +0200 +++ b/mxtool/mx.py Tue Sep 02 14:45:51 2014 +0200 @@ -33,7 +33,7 @@ Full documentation can be found at https://wiki.openjdk.java.net/display/Graal/The+mx+Tool """ -import sys, os, errno, time, subprocess, shlex, types, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch +import sys, os, errno, time, subprocess, shlex, types, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch, platform import multiprocessing import textwrap import socket @@ -1207,6 +1207,22 @@ else: abort('Unknown operating system ' + sys.platform) +def get_arch(): + machine = platform.uname()[4] + if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']: + return 'amd64' + if machine in ['sun4v', 'sun4u']: + return 'sparcv9' + if machine == 'i386' and get_os() == 'darwin': + try: + # Support for Snow Leopard and earlier version of MacOSX + if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1': + return 'amd64' + except OSError: + # sysctl is not available + pass + abort('unknown or unsupported architecture: os=' + get_os() + ', machine=' + machine) + def _loadSuite(mxDir, primary=False): """ Load a suite from 'mxDir'.