comparison mxtool/mx.py @ 14940:82971f397b94

mx.JavaConfig: filter non-existant paths from bootclasspath, extdirs and endorseddirs
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 02 Apr 2014 14:19:38 +0200
parents dd5095578b79
children e1ce6c66f56e
comparison
equal deleted inserted replaced
14939:dd5095578b79 14940:82971f397b94
1378 return self.versionString 1378 return self.versionString
1379 1379
1380 def __cmp__(self, other): 1380 def __cmp__(self, other):
1381 return cmp(self.parts, other.parts) 1381 return cmp(self.parts, other.parts)
1382 1382
1383 def _filter_non_existant_paths(paths):
1384 return os.pathsep.join([path for path in paths.split(os.pathsep) if exists(path)])
1385
1383 """ 1386 """
1384 A JavaConfig object encapsulates info on how Java commands are run. 1387 A JavaConfig object encapsulates info on how Java commands are run.
1385 """ 1388 """
1386 class JavaConfig: 1389 class JavaConfig:
1387 def __init__(self, java_home, java_dbg_port): 1390 def __init__(self, java_home, java_dbg_port):
1429 javaSource = join(myDir, 'ClasspathDump.java') 1432 javaSource = join(myDir, 'ClasspathDump.java')
1430 subprocess.check_call([self.javac, '-d', myDir, javaSource]) 1433 subprocess.check_call([self.javac, '-d', myDir, javaSource])
1431 self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', myDir, 'ClasspathDump']).split('|')] 1434 self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', myDir, 'ClasspathDump']).split('|')]
1432 if not self._bootclasspath or not self._extdirs or not self._endorseddirs: 1435 if not self._bootclasspath or not self._extdirs or not self._endorseddirs:
1433 warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'") 1436 warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'")
1437 self._bootclasspath = _filter_non_existant_paths(self._bootclasspath)
1438 self._extdirs = _filter_non_existant_paths(self._extdirs)
1439 self._endorseddirs = _filter_non_existant_paths(self._endorseddirs)
1434 1440
1435 def __hash__(self): 1441 def __hash__(self):
1436 return hash(self.jdk) 1442 return hash(self.jdk)
1437 1443
1438 def __cmp__(self, other): 1444 def __cmp__(self, other):