Imported Upstream version 1.35.9
[platform/upstream/gobject-introspection.git] / giscanner / girwriter.py
index ea9305c..d6b3485 100644 (file)
@@ -30,23 +30,15 @@ COMPATIBLE_GIR_VERSION = '1.2'
 
 class GIRWriter(XMLWriter):
 
-    def __init__(self, namespace, shlibs, includes, pkgs, c_includes):
+    def __init__(self, namespace):
         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,
-                               c_includes)
-
-    def _write_repository(self, namespace, shlibs, includes=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()
+        self._write_repository(namespace)
+
+    def _write_repository(self, namespace):
         attrs = [
             ('version', COMPATIBLE_GIR_VERSION),
             ('xmlns', 'http://www.gtk.org/introspection/core/1.0'),
@@ -54,14 +46,14 @@ and/or use gtk-doc annotations. ''')
             ('xmlns:glib', 'http://www.gtk.org/introspection/glib/1.0'),
             ]
         with self.tagcontext('repository', attrs):
-            for include in sorted(includes):
+            for include in sorted(namespace.includes):
                 self._write_include(include)
-            for pkg in sorted(set(packages)):
+            for pkg in sorted(set(namespace.exported_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, shlibs)
+            self._write_namespace(namespace)
             self._namespace = None
 
     def _write_include(self, include):
@@ -76,10 +68,10 @@ and/or use gtk-doc annotations. ''')
         attrs = [('name', c_include)]
         self.write_tag('c:include', attrs)
 
-    def _write_namespace(self, namespace, shlibs):
+    def _write_namespace(self, namespace):
         attrs = [('name', namespace.name),
                  ('version', namespace.version),
-                 ('shared-library', ','.join(shlibs)),
+                 ('shared-library', ','.join(namespace.shared_libraries)),
                  ('c:identifier-prefixes', ','.join(namespace.identifier_prefixes)),
                  ('c:symbol-prefixes', ','.join(namespace.symbol_prefixes))]
         with self.tagcontext('namespace', attrs):