def get_merged_info(mcp_dir): joined = os.path.join(mcp_dir, 'conf', 'joined.srg') values = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}} if not os.path.isfile(joined): sys.path.append('install') from fml import gen_merged_srg values = gen_merged_srg(mcp_dir, None) else: with open(joined, 'r') as fh: for line in fh: pts = line.rstrip('\r\n').split(' ') if pts[0] == 'MD:': values[pts[0]][pts[1] + ' ' + pts[2]] = pts[3] + ' ' + pts[4] else: values[pts[0]][pts[1]] = pts[2] return {t:{v.split(' ')[0]:k for k, v in m.items()} for t,m in values.items()}
def get_merged_info(mcp_dir): joined = os.path.join(mcp_dir, 'conf', 'joined.srg') values = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}} if not os.path.isfile(joined): sys.path.append('install') from fml import gen_merged_srg values = gen_merged_srg(mcp_dir, None) else: with open(joined, 'r') as fh: for line in fh: pts = line.rstrip('\r\n').split(' ') if pts[0] == 'MD:': values[pts[0]][pts[1] + ' ' + pts[2]] = pts[3] + ' ' + pts[4] else: values[pts[0]][pts[1]] = pts[2] return { t: {v.split(' ')[0]: k for k, v in m.items()} for t, m in values.items() }
import os, os.path, sys import urllib, zipfile import shutil, glob, fnmatch import subprocess, logging, re, shlex import csv print(os.getcwd()) sys.path.append("install") from fml import gen_merged_srg ctorsigre = re.compile("<init>\((.*)\)") ctorparamre = re.compile("(([ZBCSIJFD]|L([\w\/]+);))") common = gen_merged_srg("..", None) rev_common = {t: {v.split(" ")[0]: k for k, v in m.items()} for t, m in common.items()} if len(sys.argv) < 2: print("Give me a file to process please") sys.exit(1) print(sys.argv, len(sys.argv)) if sys.argv[1] == "mcp_merge.cfg": print("Fixing mcp_merge.cfg") with open("mcp_merge.cfg-new", "w") as nf: with open(sys.argv[1]) as f: for line in f: parts = line.split("#") target = parts[1].strip() newpart = parts[0][0] + rev_common["CL:"][target] + " #" + target + "\n" nf.write(newpart) sys.exit(0) elif len(sys.argv) == 2:
import os, os.path, sys import urllib, zipfile import shutil, glob, fnmatch import subprocess, logging, re, shlex import csv print(os.getcwd()) sys.path.append('install') from fml import gen_merged_srg ctorsigre = re.compile('<init>\((.*)\)') ctorparamre = re.compile('(([ZBCSIJFD]|L([\w\/]+);))') common = gen_merged_srg('..',None) rev_common = {t:{v.split(' ')[0]:k for k, v in m.items()} for t,m in common.items()} if len(sys.argv) < 1: print('Give me a file to process please') sys.exit(1) if sys.argv[1]=='mcp_merge.cfg': print('Fixing mcp_merge.cfg') with open('mcp_merge.cfg-new','w') as nf: with open(sys.argv[1]) as f: for line in f: parts = line.split('#') target = parts[1].strip() newpart = parts[0][0]+rev_common['CL:'][target]+" #"+target+'\n' nf.write(newpart) sys.exit(0) elif len(sys.argv)==1: with open(sys.argv[1]+'-new','w') as nf: with open(sys.argv[1]) as f: