# HG changeset patch # User Doug Simon # Date 1320874664 -3600 # Node ID c773cc740d4af07177ec26f012670b27ded6c698 # Parent 77ae87a2dd04ee18e6772b4e05e14a036756f83b Improved error messages in gl.py. diff -r 77ae87a2dd04 -r c773cc740d4a pytools/commands.py --- a/pytools/commands.py Wed Nov 09 14:53:09 2011 +0100 +++ b/pytools/commands.py Wed Nov 09 22:37:44 2011 +0100 @@ -126,12 +126,14 @@ def fix_jvm_cfg(env, jdk): jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') found = False + if not exists(jvmCfg): + env.abort(jvmCfg + ' does not exist') + with open(jvmCfg) as f: for line in f: if '-graal KNOWN' in line: found = True break - if not found: env.log('Appending "-graal KNOWN" to ' + jvmCfg) with open(jvmCfg, 'a') as f: diff -r 77ae87a2dd04 -r c773cc740d4a pytools/gl.py --- a/pytools/gl.py Wed Nov 09 14:53:09 2011 +0100 +++ b/pytools/gl.py Wed Nov 09 22:37:44 2011 +0100 @@ -70,9 +70,11 @@ self.parse_args(namespace=self) - if self.jdk7 is None or not isdir(self.jdk7): - self.log('JDK7 is required. Use --jdk7 option or set JDK7 environment variable (in ' + configFile + ')') - self.abort(1) + if self.jdk7 is None: + self.abort('JDK7 is required. Use --jdk7 option or set JDK7 environment variable (in ' + configFile + ')') + + if not isdir(self.jdk7): + self.abort('Specified JDK7 path is not a directory: ' + self.jdk7) self.graal_home = dirname(abspath(dirname(sys.argv[0]))) @@ -98,8 +100,7 @@ elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): return 'windows' else: - print 'Supported operating system could not be derived from', sys.platform - self.abort(1) + self.abort('Supported operating system could not be derived from ' + sys.platform) def exe(self, name): @@ -109,18 +110,15 @@ def run_dacapo(self, args): if not isfile(self.dacapo) or not self.dacapo.endswith('.jar'): - self.log('Specified DaCapo jar file does not exist or is not a jar file: ' + self.dacapo) - self.abort(1) + self.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + self.dacapo) return self.run_vm(['-Xms1g', '-Xmx2g', '-esa', '-XX:-GraalBailoutIsFatal', '-G:-QuietBailout', '-cp', self.dacapo] + args) def run_vm(self, args): if self.maxine is None: configFile = join(dirname(sys.argv[0]), 'glrc') - self.log('Path to Maxine code base must be specified with -M option or MAXINE environment variable (in ' + configFile + ')') - self.abort(1) + self.abort('Path to Maxine code base must be specified with -M option or MAXINE environment variable (in ' + configFile + ')') if not exists(join(self.maxine, 'com.oracle.max.graal.hotspot', 'bin', 'com', 'oracle', 'max', 'graal', 'hotspot', 'VMEntriesNative.class')): - self.log('Maxine code base path specified -M option or MAXINE environment variable does not contain com.oracle.max.graal.hotspot/bin/com/oracle/max/graal/hotspot/VMEntriesNative.class: ' + self.maxine) - self.abort(1) + self.abort('Maxine code base path specified -M option or MAXINE environment variable does not contain com.oracle.max.graal.hotspot/bin/com/oracle/max/graal/hotspot/VMEntriesNative.class: ' + self.maxine) os.environ['MAXINE'] = self.maxine exe = join(self.jdk7, 'bin', self.exe('java')) @@ -140,8 +138,7 @@ assert isinstance(args, types.ListType), "'args' must be a list: " + str(args) for arg in args: if not isinstance(arg, types.StringTypes): - self.log('argument is not a string: ' + str(arg)) - self.abort(1) + self.abort('argument is not a string: ' + str(arg)) if self.verbose: self.log(' '.join(args))