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 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 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) 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 _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 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>")