def generate(self): sys.path.append("codegen") from override import Overrides from defsparser import DefsParser from codegen import register_types, write_source, FileOutput if self.check_dates(): return for item in self.register: dp = DefsParser(item) dp.startParsing() register_types(dp) dp = DefsParser(self.defs) dp.startParsing() register_types(dp) fd = open(self.output, "w") write_source(dp, Overrides(self.override), self.prefix, FileOutput(fd, self.output)) fd.close()
def generate(self): sys.path.append('codegen') from override import Overrides from defsparser import DefsParser from codegen import register_types, write_source, FileOutput if self.check_dates(): return for item in self.register: dp = DefsParser(item) dp.startParsing() register_types(dp) dp = DefsParser(self.defs) dp.startParsing() register_types(dp) fd = open(self.output, 'w') write_source(dp, Overrides(self.override), self.prefix, FileOutput(fd, self.output)) fd.close()
if len(f) == 0: continue f = os.path.join(files_prefix, f) print "Parsing %s" % f (pth, fn) = os.path.split(f) (fn, ext) = os.path.splitext(fn) cmd = 'cpp -DLANGUAGE_PYTHON=1 %s' % f.replace(" ", "\ ") proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, cwd=cwd, ) stdout_value, stderr_value = proc.communicate('') p.startParsing(stdout_value, modname, filename=f) codegen.register_types(p) fo = codegen.FileOutput(open(output_fname, "w")) sw = codegen.SourceWriter(p, modname, fo) sw.write() fo.close() if p.custom_methods: print "Methods that need custom implementation:" for o, m in p.custom_methods: print "\t{}.{}".format(o.name, m.name)