2012-08-02 07:51:51 +00:00
--- commands.py
+++ commands.py
2013-07-10 22:23:21 +00:00
@@ -126,8 +126,8 @@
def truncate(text, length):
- if len(text) > length:
- return text[:length] + '...'
+ #if len(text) > length:
+ # return text[:length] + '...'
return text
2013-06-30 17:17:20 +00:00
@@ -139,6 +139,8 @@
2013-03-09 17:25:24 +00:00
fieldnames = csvreader.fieldnames
return set(fieldnames)
+def commands_sanity_check():
2013-06-28 03:48:52 +00:00
+ print ' Commands patch applied successfully'
2013-03-09 17:25:24 +00:00
class Commands(object):
"""Contains the commands and initialisation for a full mcp run"""
2013-07-07 19:49:11 +00:00
@@ -950,6 +952,8 @@
2012-10-31 14:40:40 +00:00
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
2013-02-26 22:34:51 +00:00
+ if side == SERVER and not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
2012-10-31 14:40:40 +00:00
+ return self.checkbins(CLIENT)
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
return False
return True
2013-07-16 21:34:43 +00:00
@@ -1281,23 +1285,34 @@
2013-04-23 11:40:49 +00:00
pathbinlk = {CLIENT: self.binclient, SERVER: self.binserver}
2013-01-30 23:57:21 +00:00
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
2013-04-23 11:40:49 +00:00
+
2013-02-26 22:54:18 +00:00
+ if side == SERVER: #Warn about server because FML recombines it into client
+ self.logger.info('Server side recompiling might be skipped, this is normal, do not complain to FML/Forge team about server side.')
2013-04-23 11:40:49 +00:00
2013-01-30 23:57:21 +00:00
if not os.path.exists(pathbinlk[side]):
os.makedirs(pathbinlk[side])
2013-07-16 20:08:26 +00:00
# HINT: We create the list of source directories based on the list of packages
# on windows we just pass wildcards, otherwise we pass the full file list
- if self.osname == 'win':
+ if self.osname == 'win' and False == True: #FML: Disable for windows we write to file now
all_files = False
append_pattern = True
else:
all_files = True
append_pattern = False
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
+ from tempfile import NamedTemporaryFile
if self.cmdrecompscala: # Compile scala before java as scala scans java files, but not vice-versa
pkglistscala = pkglist[:]
pkglistscala.extend(filterdirs(pathsrclk[side], '*.scala', append_pattern=append_pattern, all_files=all_files))
- dirs = ' '.join(pkglistscala)
+ f = NamedTemporaryFile(mode='wb', suffix='.txt', prefix ='scala_src_path_', delete=False) #FML: We write to a temporary file just in case the command is to long
+ for line in pkglistscala:
2013-07-16 21:34:43 +00:00
+ if os.sep == '\\':
+ f.write('"%s"\n' % os.path.abspath(line).replace(os.sep, os.sep + os.sep))
+ else:
+ f.write('"%s"\n' % os.path.abspath(line))
2013-07-16 20:08:26 +00:00
+ f.close()
+ dirs = '@"%s"' % f.name
classpath = os.pathsep.join(cplk[side])
forkcmd = self.cmdrecompscala.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side], pkgs=dirs)
try:
2013-07-16 21:34:43 +00:00
@@ -1317,7 +1332,15 @@
2013-07-16 20:08:26 +00:00
self.logger.error('================================')
self.logger.error('')
raise
- dirs = ' '.join(pkglist)
+ os.unlink(f.name)
+ f = NamedTemporaryFile(mode='wb', suffix='.txt', prefix ='java_src_path_', delete=False) #FML: We write to a temporary file just in case the command is to long
+ for line in pkglist:
2013-07-16 21:34:43 +00:00
+ if os.sep == '\\':
+ f.write('"%s"\n' % os.path.abspath(line).replace('\\', '\\\\'))
+ else:
+ f.write('"%s"\n' % os.path.abspath(line))
2013-07-16 20:08:26 +00:00
+ f.close()
+ dirs = '@"%s"' % f.name
classpath = os.pathsep.join(cplk[side])
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
pkgs=dirs)
2013-07-16 21:34:43 +00:00
@@ -1336,9 +1359,10 @@
2013-07-16 20:35:14 +00:00
self.logger.error('==================')
self.logger.error('')
2012-08-10 19:38:59 +00:00
raise
2013-07-16 20:35:14 +00:00
+ os.unlink(f.name)
2012-08-10 19:38:59 +00:00
2013-07-04 01:23:38 +00:00
def startserver(self, mainclass, extraargs):
2012-08-10 19:38:59 +00:00
- classpath = [self.binserver] + self.cpathserver
2013-07-04 02:30:30 +00:00
+ classpath = [self.binclient, self.srcclient] + self.cpathserver + self.cpathclient
2012-08-10 19:38:59 +00:00
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
os.chdir(self.dirjars)
2013-07-16 21:34:43 +00:00
@@ -1703,7 +1727,7 @@
2012-08-08 03:11:37 +00:00
self.runcmd(forkcmd)
2012-08-14 04:53:52 +00:00
return True
- def gathermd5s(self, side, reobf=False):
+ def gathermd5s(self, side, reobf=False, skip_fml=False):
if not reobf:
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
else:
2013-07-16 21:34:43 +00:00
@@ -1718,6 +1742,9 @@
2012-08-14 04:53:52 +00:00
class_path = ''
else:
class_path += '/'
+ if skip_fml:
+ if class_path.startswith('cpw/'):
+ continue
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))
2013-07-16 21:34:43 +00:00
@@ -1890,6 +1917,9 @@
2012-08-08 03:11:37 +00:00
sys.exit(1)
2012-08-02 07:51:51 +00:00
for entry in newfiles:
+ if 'commands.py' in entry[0]: #FML, Disable updating of Commands.py
+ print 'Update to runtime/commands.py found, but disbled due to using fml'
+ continue
if entry[3] == 'U':
2012-08-08 03:11:37 +00:00
self.logger.info('Retrieving file from server : %s', entry[0])
cur_file = os.path.normpath(entry[0])
2013-07-16 21:34:43 +00:00
@@ -1910,6 +1940,9 @@
2012-08-15 07:50:40 +00:00
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
+
+ if side == SERVER: #Noop out server side stuff
+ return
# HINT: We need a table for the old md5 and the new ones
2013-04-27 05:24:06 +00:00
md5table = {}