summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2011-08-15 17:45:09 +0200
committerTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2011-08-15 17:48:45 +0200
commit684bc3384e23b8168b06c480de09f6650a7ddd63 (patch)
tree5f7d96268f17331968061f35314385997b0d9f1e
parenta6b3f191069855c3ff973998178bf161aef458f4 (diff)
downloadgobject-introspection-684bc3384e23b8168b06c480de09f6650a7ddd63.tar.gz
giscanner: Allow passing additional include dirs when parsing a gir
-rw-r--r--giscanner/docmain.py9
-rw-r--r--giscanner/transformer.py4
2 files changed, 11 insertions, 2 deletions
diff --git a/giscanner/docmain.py b/giscanner/docmain.py
index 9bca4c85..e6ae8b60 100644
--- a/giscanner/docmain.py
+++ b/giscanner/docmain.py
@@ -18,6 +18,7 @@
# 02110-1301, USA.
#
+import os
import optparse
from .docbookwriter import DocBookWriter
@@ -31,7 +32,13 @@ from .transformer import Transformer
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)
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 565d996e..74985ffe 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -179,8 +179,10 @@ None."""
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)