comparison mxtool/mx.py @ 16534:4aaa97f42b92

mx: be less strict while parsing the jvm version
author Bernhard Urban <bernhard.urban@jku.at>
date Tue, 15 Jul 2014 11:52:45 +0200
parents 59fdea1f9e36
children cc30bd72a19b
comparison
equal deleted inserted replaced
16533:d5c4bb0039d8 16534:4aaa97f42b92
1734 output = subprocess.check_output([self.java, '-version'], stderr=subprocess.STDOUT) 1734 output = subprocess.check_output([self.java, '-version'], stderr=subprocess.STDOUT)
1735 except subprocess.CalledProcessError as e: 1735 except subprocess.CalledProcessError as e:
1736 print e.output 1736 print e.output
1737 abort(e.returncode) 1737 abort(e.returncode)
1738 1738
1739 output = output.split() 1739 def _checkOutput(out):
1740 assert output[1] == 'version' 1740 return 'java version' in out
1741 self.version = VersionSpec(output[2].strip('"')) 1741
1742 # hotspot can print a warning, e.g. if there's a .hotspot_compiler file in the cwd
1743 output = output.split('\n')
1744 version = None
1745 for o in output:
1746 if _checkOutput(o):
1747 assert version is None
1748 version = o
1749
1750 self.version = VersionSpec(version.split()[2].strip('"'))
1742 self.javaCompliance = JavaCompliance(self.version.versionString) 1751 self.javaCompliance = JavaCompliance(self.version.versionString)
1743 1752
1744 if self.debug_port is not None: 1753 if self.debug_port is not None:
1745 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] 1754 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)]
1746 1755
1749 outDir = join(dirname(__file__), '.jdk' + str(self.version)) 1758 outDir = join(dirname(__file__), '.jdk' + str(self.version))
1750 if not exists(outDir): 1759 if not exists(outDir):
1751 os.makedirs(outDir) 1760 os.makedirs(outDir)
1752 javaSource = join(myDir, 'ClasspathDump.java') 1761 javaSource = join(myDir, 'ClasspathDump.java')
1753 if not exists(join(outDir, 'ClasspathDump.class')): 1762 if not exists(join(outDir, 'ClasspathDump.class')):
1754 subprocess.check_call([self.javac, '-d', outDir, javaSource]) 1763 subprocess.check_call([self.javac, '-d', outDir, javaSource], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
1755 self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', outDir, 'ClasspathDump']).split('|')] 1764 self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', outDir, 'ClasspathDump'], stderr=subprocess.PIPE).split('|')]
1756 if not self._bootclasspath or not self._extdirs or not self._endorseddirs: 1765 if not self._bootclasspath or not self._extdirs or not self._endorseddirs:
1757 warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'") 1766 warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'")
1758 self._bootclasspath = _filter_non_existant_paths(self._bootclasspath) 1767 self._bootclasspath = _filter_non_existant_paths(self._bootclasspath)
1759 self._extdirs = _filter_non_existant_paths(self._extdirs) 1768 self._extdirs = _filter_non_existant_paths(self._extdirs)
1760 self._endorseddirs = _filter_non_existant_paths(self._endorseddirs) 1769 self._endorseddirs = _filter_non_existant_paths(self._endorseddirs)