diff options
author | Colin Walters <walters@verbum.org> | 2013-02-24 12:07:28 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-02-26 16:25:11 -0500 |
commit | c0ebb1e9888ee745437e87482d0b89c30cab355f (patch) | |
tree | 160cda71e4102e7e0dc8f6d25081e84295435eb3 /giscanner | |
parent | 95f80c1ae03dfe8a68d3c7ec21ce696ac839ea57 (diff) | |
download | gobject-introspection-c0ebb1e9888ee745437e87482d0b89c30cab355f.tar.gz |
scanner: internals cleanup: Move c_includes to Namespace
Continuation of previous work.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/ast.py | 1 | ||||
-rw-r--r-- | giscanner/girparser.py | 4 | ||||
-rw-r--r-- | giscanner/girwriter.py | 12 | ||||
-rwxr-xr-x | giscanner/scannermain.py | 6 |
4 files changed, 9 insertions, 14 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py index 23a0c9e7..506643d0 100644 --- a/giscanner/ast.py +++ b/giscanner/ast.py @@ -374,6 +374,7 @@ class Namespace(object): self.symbols = {} # Maps from function symbols -> Function self.includes = set() # Include self.shared_libraries = [] # str + self.c_includes = [] # str def type_from_name(self, name, ctype=None): """Backwards compatibility method for older .gir files, which diff --git a/giscanner/girparser.py b/giscanner/girparser.py index bae09b9a..5944cc41 100644 --- a/giscanner/girparser.py +++ b/giscanner/girparser.py @@ -70,9 +70,6 @@ class GIRParser(object): def get_namespace(self): return self._namespace - def get_c_includes(self): - return self._c_includes - def get_c_prefix(self): return self._c_prefix @@ -137,6 +134,7 @@ class GIRParser(object): if 'shared-library' in ns.attrib: self._namespace.shared_libraries = ns.attrib['shared-library'].split(',') self._namespace.includes = self._includes + self._namespace.c_includes = self._c_includes parser_methods = { _corens('alias'): self._parse_alias, diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index e15ad51f..58169eba 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -30,21 +30,17 @@ COMPATIBLE_GIR_VERSION = '1.2' class GIRWriter(XMLWriter): - def __init__(self, namespace, pkgs, c_includes): + def __init__(self, namespace, pkgs): super(GIRWriter, self).__init__() self.write_comment( '''This file was automatically generated from C sources - DO NOT EDIT! To affect the contents of this file, edit the original C definitions, and/or use gtk-doc annotations. ''') - self._write_repository(namespace, pkgs, - c_includes) + self._write_repository(namespace, pkgs) - def _write_repository(self, namespace, - packages=None, c_includes=None): + def _write_repository(self, namespace, packages=None): if packages is None: packages = frozenset() - if c_includes is None: - c_includes = frozenset() attrs = [ ('version', COMPATIBLE_GIR_VERSION), ('xmlns', 'http://www.gtk.org/introspection/core/1.0'), @@ -56,7 +52,7 @@ and/or use gtk-doc annotations. ''') self._write_include(include) for pkg in sorted(set(packages)): self._write_pkgconfig_pkg(pkg) - for c_include in sorted(set(c_includes)): + for c_include in sorted(set(namespace.c_includes)): self._write_c_include(c_include) self._namespace = namespace self._write_namespace(namespace) diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index ccd828da..3d402fac 100755 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py @@ -194,8 +194,7 @@ def passthrough_gir(path, f): parser.parse(path) writer = GIRWriter(parser.get_namespace(), - parser.get_pkgconfig_packages(), - parser.get_c_includes()) + parser.get_pkgconfig_packages()) f.write(writer.get_xml()) def test_codegen(optstring): @@ -473,8 +472,9 @@ def scanner_main(args): else: exported_packages = options.packages + transformer.namespace.c_includes = options.c_includes writer = Writer(transformer.namespace, - exported_packages, options.c_includes) + exported_packages) data = writer.get_xml() write_output(data, options) |