comparison mx/commands.py @ 12540:0aa37fd2f33e

mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
author Bernhard Urban <bernhard.urban@jku.at>
date Wed, 23 Oct 2013 15:31:47 +0200
parents 98caa3872d83
children 110c3faa57e9
comparison
equal deleted inserted replaced
12539:97f56b7e978e 12540:0aa37fd2f33e
242 def _arch(): 242 def _arch():
243 machine = platform.uname()[4] 243 machine = platform.uname()[4]
244 if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']: 244 if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']:
245 return 'amd64' 245 return 'amd64'
246 if machine in ['sun4v', 'sun4u']: 246 if machine in ['sun4v', 'sun4u']:
247 return 'sparc' 247 return 'sparcv9'
248 if machine == 'i386' and mx.get_os() == 'darwin': 248 if machine == 'i386' and mx.get_os() == 'darwin':
249 try: 249 try:
250 # Support for Snow Leopard and earlier version of MacOSX 250 # Support for Snow Leopard and earlier version of MacOSX
251 if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1': 251 if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1':
252 return 'amd64' 252 return 'amd64'
318 jvmCfgLines = [] 318 jvmCfgLines = []
319 with open(jvmCfg) as f: 319 with open(jvmCfg) as f:
320 for line in f: 320 for line in f:
321 if line.startswith('-') and defaultVM is None: 321 if line.startswith('-') and defaultVM is None:
322 parts = line.split() 322 parts = line.split()
323 assert len(parts) == 2, parts 323 if len(parts) == 2:
324 assert parts[1] == 'KNOWN', parts[1] 324 assert parts[1] == 'KNOWN', parts[1]
325 defaultVM = parts[0][1:] 325 defaultVM = parts[0][1:]
326 jvmCfgLines += ['# default VM is a copy of the unmodified ' + defaultVM + ' VM\n'] 326 jvmCfgLines += ['# default VM is a copy of the unmodified ' + defaultVM + ' VM\n']
327 jvmCfgLines += ['-original KNOWN\n'] 327 jvmCfgLines += ['-original KNOWN\n']
328 else:
329 # skip lines which we cannot parse (e.g. '-hotspot ALIASED_TO -client')
330 pass
328 else: 331 else:
329 jvmCfgLines += [line] 332 jvmCfgLines += [line]
330 333
331 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg 334 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg
332 if mx.get_os() != 'windows': 335 if mx.get_os() != 'windows':