summaryrefslogtreecommitdiff
path: root/giscanner/girwriter.py
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-02-19 17:52:22 -0500
committerColin Walters <walters@verbum.org>2009-02-20 09:10:46 -0500
commitff4628ced457a5460f854abb8cdf923cd67c4e6e (patch)
treea9ea00be6333511b7ea1232b039523731f1fe0b8 /giscanner/girwriter.py
parentc86b12154bda14294dddf58bf3026c487566e3af (diff)
downloadgobject-introspection-ff4628ced457a5460f854abb8cdf923cd67c4e6e.tar.gz
Bug 572423 - Support --c-include argument for specifying C headers
This option is for specifying inside the .gir what C header files should be included by C consumers (as opposed to parsed by the scanner).
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r--giscanner/girwriter.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 116681ae..4742840d 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -33,20 +33,22 @@ from .xmlwriter import XMLWriter
class GIRWriter(XMLWriter):
- def __init__(self, namespace, shlibs, includes, pkgs):
+ def __init__(self, namespace, shlibs, includes, pkgs, c_includes):
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, shlibs, includes, pkgs)
+ self._write_repository(namespace, shlibs, includes, pkgs, c_includes)
def _write_repository(self, namespace, shlibs, includes=None,
- packages=None):
+ packages=None, c_includes=None):
if includes is None:
includes = frozenset()
if packages is None:
packages = frozenset()
+ if c_includes is None:
+ c_includes = frozenset()
attrs = [
('version', '1.0'),
('xmlns', 'http://www.gtk.org/introspection/core/1.0'),
@@ -58,6 +60,8 @@ 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)):
+ self._write_c_include(c_include)
self._write_namespace(namespace, shlibs)
def _write_include(self, include):
@@ -68,6 +72,10 @@ and/or use gtk-doc annotations. ''')
attrs = [('name', package)]
self.write_tag('package', attrs)
+ def _write_c_include(self, c_include):
+ attrs = [('name', c_include)]
+ self.write_tag('c:include', attrs)
+
def _write_namespace(self, namespace, shlibs):
libraries = []
for l in shlibs: