Krenair

MCP 7.0pre 7.0 runtime diff

Aug 2nd, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. diff -r /home/alex/MCP/7.0pre/runtime/commands.py /home/alex/MCP/7.0/runtime/commands.py
  2. 318a319,320
  3. > if self.has_renumber_csv:
  4. > reqs.append('renumber csv')
  5. 412a415
  6. > self.csvnewids = os.path.normpath(config.get('CSV', 'NewIds'))
  7. 418a422
  8. > self.has_renumber_csv = False
  9. 422a427
  10. > header_newids = csv_header(self.csvnewids)
  11. 432a438,439
  12. > if set(['client', 'server', 'newid']) <= header_newids:
  13. > self.has_renumber_csv = True
  14. 1237a1245,1307
  15. > def process_renumber(self, side):
  16. > """Renumber the sources using the CSV data"""
  17. > pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
  18. >
  19. > if not self.has_renumber_csv:
  20. > self.logger.warning('!! renumbering disabled due to no csv !!')
  21. > return False
  22. >
  23. > regexps = {
  24. > 'methods': re.compile(r'func_([0-9]+)_[a-zA-Z_]+'),
  25. > 'fields': re.compile(r'field_([0-9]+)_[a-zA-Z_]+'),
  26. > 'params': re.compile(r'p_[\d]+_'),
  27. > }
  28. >
  29. > # HINT: We read the relevant CSVs
  30. > mapping = {'methods': {}, 'fields': {}, 'params': {}}
  31. > with open(self.csvnewids, 'rb') as fh:
  32. > in_csv = csv.DictReader(fh)
  33. > for line in in_csv:
  34. > in_id = None
  35. > if side == CLIENT:
  36. > if line['client'] != '*':
  37. > in_id = line['client']
  38. > else:
  39. > if line['server'] != '*':
  40. > in_id = line['server']
  41. > if in_id:
  42. > method_match = regexps['methods'].match(in_id)
  43. > if method_match is not None:
  44. > if in_id not in mapping['methods']:
  45. > mapping['methods'][in_id] = line['newid']
  46. > in_param = 'p_' + method_match.group(1) + '_'
  47. > method_match = regexps['methods'].match(line['newid'])
  48. > if method_match is not None:
  49. > out_param = 'p_' + method_match.group(1) + '_'
  50. > mapping['params'][in_param] = out_param
  51. > field_match = regexps['fields'].match(in_id)
  52. > if field_match is not None:
  53. > if in_id not in mapping['fields']:
  54. > mapping['fields'][in_id] = line['newid']
  55. >
  56. > def updatefile(src_file):
  57. > tmp_file = src_file + '.tmp'
  58. > with open(src_file, 'r') as fh:
  59. > buf = fh.read()
  60. > for group in mapping.keys():
  61. > def mapname(match):
  62. > try:
  63. > return mapping[group][match.group(0)]
  64. > except KeyError:
  65. > pass
  66. > return match.group(0)
  67. > buf = regexps[group].sub(mapname, buf)
  68. > with open(tmp_file, 'w') as fh:
  69. > fh.write(buf)
  70. > shutil.move(tmp_file, src_file)
  71. >
  72. > # HINT: We pathwalk the sources
  73. > for path, _, filelist in os.walk(pathsrclk[side], followlinks=True):
  74. > for cur_file in fnmatch.filter(filelist, '*.java'):
  75. > updatefile(os.path.normpath(os.path.join(path, cur_file)))
  76. > return True
  77. >
  78. 1483c1553,1555
  79. < self.logger.info('> File %s not found for %s', out_class, in_class)
  80. ---
  81. > self.logger.error('* File %s not found for %s', out_class, in_class)
  82. > except IOError:
  83. > self.logger.error('* File %s failed extracting for %s', out_class, in_class)
  84. 1579,1580c1651,1656
  85. < shutil.copyfile(src_file, dest_file)
  86. < self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
  87. ---
  88. > try:
  89. > shutil.copyfile(src_file, dest_file)
  90. > self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
  91. > except IOError:
  92. > self.logger.error('* File %s copy failed', in_class)
  93. >
  94. Binary files /home/alex/MCP/7.0pre/runtime/commands.pyc and /home/alex/MCP/7.0/runtime/commands.pyc differ
  95. Binary files /home/alex/MCP/7.0pre/runtime/filehandling/__init__.pyc and /home/alex/MCP/7.0/runtime/filehandling/__init__.pyc differ
  96. Binary files /home/alex/MCP/7.0pre/runtime/filehandling/srgsexport.pyc and /home/alex/MCP/7.0/runtime/filehandling/srgsexport.pyc differ
  97. Binary files /home/alex/MCP/7.0pre/runtime/filehandling/srgshandler.pyc and /home/alex/MCP/7.0/runtime/filehandling/srgshandler.pyc differ
  98. diff -r /home/alex/MCP/7.0pre/runtime/mcp.py /home/alex/MCP/7.0/runtime/mcp.py
  99. 175a176,189
  100. >
  101. >
  102. > def updateids_side(commands, side, no_comments=False):
  103. > if not commands.checksourcedir(side):
  104. > return False
  105. > starttime = time.time()
  106. > commands.logger.info('== Updating %s ==', SIDE_NAME[side])
  107. > if commands.has_renumber_csv:
  108. > commands.logger.info('> Renumbering sources')
  109. > commands.process_renumber(side)
  110. > else:
  111. > commands.logger.warning('!! renumbering disabled due to no csvs !!')
  112. > commands.logger.info('- Done in %.2f seconds', time.time() - starttime)
  113. > return True
  114. Binary files /home/alex/MCP/7.0pre/runtime/mcp.pyc and /home/alex/MCP/7.0/runtime/mcp.pyc differ
  115. 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
  116. Binary files /home/alex/MCP/7.0pre/runtime/pylibs/cleanup_src.pyc and /home/alex/MCP/7.0/runtime/pylibs/cleanup_src.pyc differ
  117. Binary files /home/alex/MCP/7.0pre/runtime/pylibs/fffix.pyc and /home/alex/MCP/7.0/runtime/pylibs/fffix.pyc differ
  118. Binary files /home/alex/MCP/7.0pre/runtime/pylibs/__init__.pyc and /home/alex/MCP/7.0/runtime/pylibs/__init__.pyc differ
  119. Binary files /home/alex/MCP/7.0pre/runtime/pylibs/jadfix.pyc and /home/alex/MCP/7.0/runtime/pylibs/jadfix.pyc differ
  120. Binary files /home/alex/MCP/7.0pre/runtime/pylibs/normlines.pyc and /home/alex/MCP/7.0/runtime/pylibs/normlines.pyc differ
  121. Binary files /home/alex/MCP/7.0pre/runtime/pylibs/normpatch.pyc and /home/alex/MCP/7.0/runtime/pylibs/normpatch.pyc differ
  122. Binary files /home/alex/MCP/7.0pre/runtime/pylibs/whereis.pyc and /home/alex/MCP/7.0/runtime/pylibs/whereis.pyc differ
  123. Only in /home/alex/MCP/7.0/runtime: updateids.py
Advertisement
Add Comment
Please, Sign In to add comment