Fix when an old scalac is present on the system to not fail the build

This commit is contained in:
Christian 2013-04-23 22:43:51 -04:00
parent cee176eb96
commit 5a81b37bcf
1 changed files with 33 additions and 20 deletions

View File

@ -44,7 +44,7 @@
self.cmdstartsrv = self.config.get('COMMANDS', 'CmdStartSrv', raw=1) % self.cmdjava
self.cmdstartclt = self.config.get('COMMANDS', 'CmdStartClt', raw=1) % self.cmdjava
@@ -751,6 +760,28 @@
@@ -751,6 +760,36 @@
self.cmdjavac = '"%s"' % os.path.join(results[0], 'javac')
self.cmdjava = '"%s"' % os.path.join(results[0], 'java')
@ -56,7 +56,7 @@
+ self.runcmd('scalac -version', quiet=True)
+ results.append('')
+ except (CalledProcessError, OSError):
+ pass
+ pass
+ if not results: # Stupid windows...
+ try:
+ # TODO: Verify at least version 2.10
@ -64,16 +64,24 @@
+ results.append('')
+ except (CalledProcessError, OSError):
+ pass
+ if not results:
+ self.logger.warning('"scalac"" is not found on the PATH. Scala files will not be recompiled')
+ self.cmdscalac = None
+ try:
+ self.runcmd('scala -target:jvm-1.6', quiet=True)
+ results.append('')
+ except (CalledProcessError, OSError):
+ self.logger.info('"scala" does not support jvm-1.6 target, it is out of date. Ignoring')
+ results = []
+ self.cmdscalac = None
+ else:
+ self.cmdscalac = '"%s"' % os.path.join(results[0], 'scalac')
+ if not results:
+ self.logger.warning('"scalac" is not found on the PATH. Scala files will not be recompiled')
+ self.cmdscalac = None
+ else:
+ self.cmdscalac = '"%s"' % os.path.join(results[0], 'scalac')
+
def checkjars(self, side):
jarlk = {CLIENT: self.jarclient, SERVER: self.jarserver}
md5jarlk = {CLIENT: self.md5jarclt, SERVER: self.md5jarsrv}
@@ -796,6 +827,8 @@
@@ -796,6 +835,8 @@
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
@ -82,7 +90,7 @@
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
return False
return True
@@ -1036,6 +1069,9 @@
@@ -1036,6 +1077,9 @@
pathbinlk = {CLIENT: self.binclient, SERVER: self.binserver}
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
@ -92,7 +100,7 @@
if not os.path.exists(pathbinlk[side]):
os.makedirs(pathbinlk[side])
@@ -1049,6 +1085,29 @@
@@ -1049,6 +1093,29 @@
all_files = True
append_pattern = False
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
@ -122,7 +130,7 @@
dirs = ' '.join(pkglist)
classpath = os.pathsep.join(cplk[side])
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
@@ -1057,7 +1116,7 @@
@@ -1057,7 +1124,7 @@
self.runcmd(forkcmd, log_file=pathlog[side])
except CalledProcessError as ex:
self.logger.error('')
@ -131,7 +139,7 @@
self.logger.error('')
for line in ex.output.splitlines():
if line.strip():
@@ -1070,7 +1129,7 @@
@@ -1070,7 +1137,7 @@
raise
def startserver(self):
@ -140,7 +148,7 @@
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
os.chdir(self.dirjars)
@@ -1078,7 +1137,7 @@
@@ -1078,7 +1145,7 @@
self.runmc(forkcmd)
def startclient(self):
@ -149,7 +157,7 @@
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
natives = os.path.join('..', self.dirnatives)
@@ -1205,20 +1264,20 @@
@@ -1205,20 +1272,20 @@
with open(self.csvmethods, 'rb') as fh:
methodsreader = csv.DictReader(fh)
for row in methodsreader:
@ -173,7 +181,7 @@
names['params'][row['param']] = row['name']
regexps = {
@@ -1352,13 +1411,13 @@
@@ -1352,13 +1419,13 @@
methods = {}
for row in methodsreader:
#HINT: Only include methods that have a non-empty description
@ -189,7 +197,7 @@
fields[row['searge']] = row['desc'].replace('*/', '* /')
regexps = {
@@ -1435,7 +1494,7 @@
@@ -1435,7 +1502,7 @@
self.runcmd(forkcmd)
return True
@ -198,7 +206,7 @@
if not reobf:
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
else:
@@ -1450,6 +1509,9 @@
@@ -1450,6 +1517,9 @@
class_path = ''
else:
class_path += '/'
@ -208,7 +216,7 @@
for class_file in fnmatch.filter(filelist, '*.class'):
class_name = class_path + os.path.splitext(class_file)[0]
bin_file = os.path.normpath(os.path.join(path, class_file))
@@ -1546,6 +1608,8 @@
@@ -1546,6 +1616,8 @@
if not os.path.exists(outpathlk[side]):
os.makedirs(outpathlk[side])
@ -217,7 +225,7 @@
# HINT: We extract the modified class files
with closing(zipfile.ZipFile(jarlk[side])) as zipjar:
for in_class in trgclasses:
@@ -1559,6 +1623,23 @@
@@ -1559,6 +1631,23 @@
out_class = out_class.replace(self.nullpkg, '')
if out_class[0] == '/':
out_class = out_class[1:]
@ -241,7 +249,7 @@
try:
zipjar.extract(out_class, outpathlk[side])
self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], out_class)
@@ -1605,6 +1686,9 @@
@@ -1605,6 +1694,9 @@
sys.exit(1)
for entry in newfiles:
@ -251,7 +259,7 @@
if entry[3] == 'U':
self.logger.info('Retrieving file from server : %s', entry[0])
cur_file = os.path.normpath(entry[0])
@@ -1625,6 +1709,9 @@
@@ -1625,6 +1717,9 @@
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
@ -261,3 +269,8 @@
# HINT: We need a table for the old md5 and the new ones
md5table = {}
@@ -1713,4 +1808,4 @@
if reverse:
for type,map in srg.items():
srg[type] = dict([[v,k] for k,v in map.items()])
- return srg+ return srg