def read_types(): result = {} pkgnames = explorer.collect_extension(basedir, '.ls2') packages = [(x, explorer.read_list(x)) for x in pkgnames] for (name, pkg) in packages: for ((p, i, t), target) in pkg: result[target] = types[t] return result
def get_lists(d, ext): result = [] packages = [explorer.read_list(x) for x in explorer.collect_extension(d, ext)] for package in packages: for line in package: if line[1] not in result: result.append(line[1]) return result
def get_lists(d, ext): result = [] packages = [ explorer.read_list(x) for x in explorer.collect_extension(d, ext) ] for package in packages: for line in package: if line[1] not in result: result.append(line[1]) return result
def parse_packages(): result = {} pkgnames = explorer.collect_extension(contentdir, '.ls2') packages = [(x, explorer.read_list(x)) for x in pkgnames] for (name, pkg) in packages: name = name[len(contentdir) + 1:] this_index = {} for ((p, i, t), target) in pkg: this_index[res_encode(p, i, t)] = target result[name] = this_index return result
def parse_packages(): result = {} pkgnames = explorer.collect_extension(contentdir, '.ls2') packages = [(x, explorer.read_list(x)) for x in pkgnames] for (name, pkg) in packages: name = name[len(contentdir)+1:] this_index = {} for ((p, i, t), target) in pkg: this_index[res_encode(p, i, t)] = target result[name] = this_index return result
import explorer import stridgen def process (res): result = [] for ((a, b, c), d) in res: mapline = stridgen.makeid(d) if mapline is None: mapline = "ERROR" result.append("%3d %3d %3d %s" % (a, b, c, mapline)) return result if __name__ == "__main__": if len(sys.argv) < 2: d = os.path.join(os.path.pardir, os.path.pardir, "sc2", "content") else: d = sys.argv[1] pkgnames = explorer.get_lists(d) packages = [explorer.read_list(x) for x in pkgnames] for (name, pkg) in zip(pkgnames, packages): newpkg = os.path.splitext(name)[0]+'.ls2' print newpkg print '-'*len(newpkg) newvals = process(pkg) for l in newvals: print l print
def deploy_ls2s(): pkgnames = explorer.get_lists(basedir) packages = [(x, explorer.read_list(x)) for x in pkgnames] for (name, pkg) in packages: deploy_ls2(name, pkg)
import os.path import explorer import stridgen def process(res): result = [] for ((a, b, c), d) in res: mapline = stridgen.makeid(d) if mapline is None: mapline = "ERROR" result.append("%3d %3d %3d %s" % (a, b, c, mapline)) return result if __name__ == "__main__": if len(sys.argv) < 2: d = os.path.join(os.path.pardir, os.path.pardir, "sc2", "content") else: d = sys.argv[1] pkgnames = explorer.get_lists(d) packages = [explorer.read_list(x) for x in pkgnames] for (name, pkg) in zip(pkgnames, packages): newpkg = os.path.splitext(name)[0] + '.ls2' print newpkg print '-' * len(newpkg) newvals = process(pkg) for l in newvals: print l print