comparison 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
comparison
equal deleted inserted replaced
17011:ccd8c2ef112e 17012:ad10671d1bbd
31 Version 1.x supports a single suite of projects. 31 Version 1.x supports a single suite of projects.
32 32
33 Full documentation can be found at https://wiki.openjdk.java.net/display/Graal/The+mx+Tool 33 Full documentation can be found at https://wiki.openjdk.java.net/display/Graal/The+mx+Tool
34 """ 34 """
35 35
36 import sys, os, errno, time, subprocess, shlex, types, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch 36 import sys, os, errno, time, subprocess, shlex, types, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch, platform
37 import multiprocessing 37 import multiprocessing
38 import textwrap 38 import textwrap
39 import socket 39 import socket
40 import tarfile 40 import tarfile
41 import hashlib 41 import hashlib
1204 return 'solaris' 1204 return 'solaris'
1205 elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): 1205 elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
1206 return 'windows' 1206 return 'windows'
1207 else: 1207 else:
1208 abort('Unknown operating system ' + sys.platform) 1208 abort('Unknown operating system ' + sys.platform)
1209
1210 def get_arch():
1211 machine = platform.uname()[4]
1212 if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']:
1213 return 'amd64'
1214 if machine in ['sun4v', 'sun4u']:
1215 return 'sparcv9'
1216 if machine == 'i386' and get_os() == 'darwin':
1217 try:
1218 # Support for Snow Leopard and earlier version of MacOSX
1219 if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1':
1220 return 'amd64'
1221 except OSError:
1222 # sysctl is not available
1223 pass
1224 abort('unknown or unsupported architecture: os=' + get_os() + ', machine=' + machine)
1209 1225
1210 def _loadSuite(mxDir, primary=False): 1226 def _loadSuite(mxDir, primary=False):
1211 """ 1227 """
1212 Load a suite from 'mxDir'. 1228 Load a suite from 'mxDir'.
1213 """ 1229 """