def parse(request): parser = GIRParser() parser.parse(GIR_PATH % "Gtk-3.0") store_parser(parser) return HttpResponse( "<html><head><title>GIR to SQL transfusion completed</title></head><body><h1>GIR to SQL transfusion completed</h1></body></html>" )
def _build_includes_parsers(parser): incs = parser.get_includes() for inc in incs: if _ns_exists(inc): continue path = GIR_PATH % str(inc) p = GIRParser() p.parse(path) store_parser(p)
def _build_includes_parsers (parser): incs = parser.get_includes() for inc in incs: if _ns_exists (inc): continue path = GIR_PATH % str(inc) p = GIRParser() p.parse(path) store_parser (p)
def handle(self, *args, **kwargs): parser = GIRParser() if len(sys.argv) == 3: library = sys.argv[2] else: library = "Gtk-3.0" print "Parsing %s" % library parser.parse(GIR_PATH % library) store_parser(parser)
def passthrough_gir(path, f): parser = GIRParser() parser.parse(path) writer = GIRWriter(parser.get_namespace(), parser.get_shared_libraries(), parser.get_includes(), parser.get_pkgconfig_packages(), parser.get_c_includes()) f.write(writer.get_xml())
def _build_includes_parsers(parser): incs = parser.get_includes() for inc in incs: if _ns_exists(inc): continue path = GIR_PATH % str(inc) if os.path.exists(path): p = GIRParser() p.parse(path) store_parser(p) else: print "WARNING: GIR not found: %s" % inc
def __init__(self, filename, translator): self.translator = translator parser = GIRParser(False) parser.parse(filename) self.path = os.path.dirname(os.path.abspath(filename)) self.package = os.path.basename(self.path) self.func_spec = {} func_spec_file = os.path.join(self.path, 'func_spec.py') func_spec_module = imp.load_source('func_spec', func_spec_file) self.func_spec = func_spec_module.func_specs config_file = os.path.join(self.path, 'config.py') config_module = imp.load_source('config', config_file) for name in dir(config_module): if name.startswith('_'): continue if name[0].islower(): continue setattr(self, name.lower(), getattr(config_module, name)) self.namespace = parser.get_namespace() self.module_name = self.namespace.name.lower() self.translator.namespaces.add(self.namespace.name) self.pkgconfig_packages = list(parser.get_pkgconfig_packages()) self.includes = list(parser.get_c_includes()) self.prefixes = self.namespace.symbol_prefixes self.functions = [] self.const_symbols = set() self.class_types = {} self.record_types = {} self.exported_functions = set() self.functions_to_handle = []
def inject(path, additions, outpath): from giscanner.girparser import GIRParser from giscanner.girwriter import GIRWriter from xml.etree.cElementTree import parse tree = parse(path) root = tree.getroot() injectDoc = parse(open(additions)) for node in injectDoc.getroot(): injectPath = node.attrib['path'] target = myxpath(root, injectPath) if not target: raise ValueError("Couldn't find path %r" % (injectPath, )) for child in node: target.append(child) parser = GIRParser() parser.parse_tree(tree) writer = GIRWriter(parser.get_namespace(), parser.get_shared_libraries(), parser.get_includes()) outf = open(outpath, 'w') outf.write(writer.get_xml()) outf.close() return 0
def typelib_xml_strip(path): from giscanner.girparser import GIRParser from giscanner.girwriter import GIRWriter from giscanner.girparser import C_NS from xml.etree.cElementTree import parse c_ns_key = '{%s}' % (C_NS, ) tree = parse(path) root = tree.getroot() for node in root.getiterator(): for attrib in list(node.attrib): if attrib.startswith(c_ns_key): del node.attrib[attrib] parser = GIRParser() parser.parse_tree(tree) writer = GIRWriter(parser.get_namespace(), parser.get_shared_libraries(), parser.get_includes()) sys.stdout.write(writer.get_xml()) return 0
def passthrough_gir(path, f): parser = GIRParser() parser.parse(path) writer = GIRWriter(parser.get_namespace()) f.write(writer.get_xml())
def passthrough_gir(path, f): parser = GIRParser() parser.parse(path) writer = GIRWriter(parser.get_namespace()) f.write(writer.get_encoded_xml())
def parse(request): parser = GIRParser() parser.parse(GIR_PATH % "Gtk-3.0") store_parser(parser) return HttpResponse("<html><head><title>GIR to SQL transfusion completed</title></head><body><h1>GIR to SQL transfusion completed</h1></body></html>")