Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r /home/alex/MCP/7.0pre/runtime/commands.py /home/alex/MCP/7.0/runtime/commands.py
- 318a319,320
- > if self.has_renumber_csv:
- > reqs.append('renumber csv')
- 412a415
- > self.csvnewids = os.path.normpath(config.get('CSV', 'NewIds'))
- 418a422
- > self.has_renumber_csv = False
- 422a427
- > header_newids = csv_header(self.csvnewids)
- 432a438,439
- > if set(['client', 'server', 'newid']) <= header_newids:
- > self.has_renumber_csv = True
- 1237a1245,1307
- > def process_renumber(self, side):
- > """Renumber the sources using the CSV data"""
- > pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
- >
- > if not self.has_renumber_csv:
- > self.logger.warning('!! renumbering disabled due to no csv !!')
- > return False
- >
- > regexps = {
- > 'methods': re.compile(r'func_([0-9]+)_[a-zA-Z_]+'),
- > 'fields': re.compile(r'field_([0-9]+)_[a-zA-Z_]+'),
- > 'params': re.compile(r'p_[\d]+_'),
- > }
- >
- > # HINT: We read the relevant CSVs
- > mapping = {'methods': {}, 'fields': {}, 'params': {}}
- > with open(self.csvnewids, 'rb') as fh:
- > in_csv = csv.DictReader(fh)
- > for line in in_csv:
- > in_id = None
- > if side == CLIENT:
- > if line['client'] != '*':
- > in_id = line['client']
- > else:
- > if line['server'] != '*':
- > in_id = line['server']
- > if in_id:
- > method_match = regexps['methods'].match(in_id)
- > if method_match is not None:
- > if in_id not in mapping['methods']:
- > mapping['methods'][in_id] = line['newid']
- > in_param = 'p_' + method_match.group(1) + '_'
- > method_match = regexps['methods'].match(line['newid'])
- > if method_match is not None:
- > out_param = 'p_' + method_match.group(1) + '_'
- > mapping['params'][in_param] = out_param
- > field_match = regexps['fields'].match(in_id)
- > if field_match is not None:
- > if in_id not in mapping['fields']:
- > mapping['fields'][in_id] = line['newid']
- >
- > def updatefile(src_file):
- > tmp_file = src_file + '.tmp'
- > with open(src_file, 'r') as fh:
- > buf = fh.read()
- > for group in mapping.keys():
- > def mapname(match):
- > try:
- > return mapping[group][match.group(0)]
- > except KeyError:
- > pass
- > return match.group(0)
- > buf = regexps[group].sub(mapname, buf)
- > with open(tmp_file, 'w') as fh:
- > fh.write(buf)
- > shutil.move(tmp_file, src_file)
- >
- > # HINT: We pathwalk the sources
- > for path, _, filelist in os.walk(pathsrclk[side], followlinks=True):
- > for cur_file in fnmatch.filter(filelist, '*.java'):
- > updatefile(os.path.normpath(os.path.join(path, cur_file)))
- > return True
- >
- 1483c1553,1555
- < self.logger.info('> File %s not found for %s', out_class, in_class)
- ---
- > self.logger.error('* File %s not found for %s', out_class, in_class)
- > except IOError:
- > self.logger.error('* File %s failed extracting for %s', out_class, in_class)
- 1579,1580c1651,1656
- < shutil.copyfile(src_file, dest_file)
- < self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
- ---
- > try:
- > shutil.copyfile(src_file, dest_file)
- > self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
- > except IOError:
- > self.logger.error('* File %s copy failed', in_class)
- >
- Binary files /home/alex/MCP/7.0pre/runtime/commands.pyc and /home/alex/MCP/7.0/runtime/commands.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/filehandling/__init__.pyc and /home/alex/MCP/7.0/runtime/filehandling/__init__.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/filehandling/srgsexport.pyc and /home/alex/MCP/7.0/runtime/filehandling/srgsexport.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/filehandling/srgshandler.pyc and /home/alex/MCP/7.0/runtime/filehandling/srgshandler.pyc differ
- diff -r /home/alex/MCP/7.0pre/runtime/mcp.py /home/alex/MCP/7.0/runtime/mcp.py
- 175a176,189
- >
- >
- > def updateids_side(commands, side, no_comments=False):
- > if not commands.checksourcedir(side):
- > return False
- > starttime = time.time()
- > commands.logger.info('== Updating %s ==', SIDE_NAME[side])
- > if commands.has_renumber_csv:
- > commands.logger.info('> Renumbering sources')
- > commands.process_renumber(side)
- > else:
- > commands.logger.warning('!! renumbering disabled due to no csvs !!')
- > commands.logger.info('- Done in %.2f seconds', time.time() - starttime)
- > return True
- Binary files /home/alex/MCP/7.0pre/runtime/mcp.pyc and /home/alex/MCP/7.0/runtime/mcp.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/pylibs/annotate_gl_constants.pyc and /home/alex/MCP/7.0/runtime/pylibs/annotate_gl_constants.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/pylibs/cleanup_src.pyc and /home/alex/MCP/7.0/runtime/pylibs/cleanup_src.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/pylibs/fffix.pyc and /home/alex/MCP/7.0/runtime/pylibs/fffix.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/pylibs/__init__.pyc and /home/alex/MCP/7.0/runtime/pylibs/__init__.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/pylibs/jadfix.pyc and /home/alex/MCP/7.0/runtime/pylibs/jadfix.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/pylibs/normlines.pyc and /home/alex/MCP/7.0/runtime/pylibs/normlines.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/pylibs/normpatch.pyc and /home/alex/MCP/7.0/runtime/pylibs/normpatch.pyc differ
- Binary files /home/alex/MCP/7.0pre/runtime/pylibs/whereis.pyc and /home/alex/MCP/7.0/runtime/pylibs/whereis.pyc differ
- Only in /home/alex/MCP/7.0/runtime: updateids.py
Advertisement
Add Comment
Please, Sign In to add comment