# 02110-1301, USA.
#
+import os
import optparse
from .docbookwriter import DocBookWriter
class GIDocGenerator(object):
def parse(self, filename):
- self.transformer = Transformer.parse_from_gir(filename)
+ if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ:
+ top_srcdir = os.environ['UNINSTALLED_INTROSPECTION_SRCDIR']
+ top_builddir = os.environ['UNINSTALLED_INTROSPECTION_BUILDDIR']
+ extra_include_dirs = [os.path.join(top_srcdir, 'gir'), top_builddir]
+ else:
+ extra_include_dirs = []
+ self.transformer = Transformer.parse_from_gir(filename, extra_include_dirs)
def generate(self, writer, output):
writer.add_transformer(self.transformer)
sys.exit(1)
@classmethod
- def parse_from_gir(cls, filename):
+ def parse_from_gir(cls, filename, extra_include_dirs=None):
self = cls(None)
+ if extra_include_dirs is not None:
+ self.set_include_paths(extra_include_dirs)
self.set_passthrough_mode()
self._parse_include(filename)
parser = self._cachestore.load(filename)