summaryrefslogtreecommitdiff
path: root/giscanner/dumper.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-11-24 02:29:01 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-03-10 19:05:19 +0530
commite84c9e75efc9d82262a5ec6036cc737c6089ab30 (patch)
tree2df9b15c83f43f433869fc3458844b6e625b70b3 /giscanner/dumper.py
parent3a7d3eee01dd5213547290c2b01db0810d4f50cc (diff)
downloadgobject-introspection-e84c9e75efc9d82262a5ec6036cc737c6089ab30.tar.gz
g-ir-scanner: Don't require SRCDIR and BUILDDIR env vars
When building with Meson, we cannot set environment variables while running custom targets and our builddir layout is different from Autotools anyway. Now g-ir-scanner and friends can autodetect when they're being run uninstalled by Meson and will find _giscanner.so and the giscanner python files in the build directory. This is very similar to what gdbus-codegen uses in glib/gio. Same for girepository/gdump.c.
Diffstat (limited to 'giscanner/dumper.py')
-rw-r--r--giscanner/dumper.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index 3c7220bc..8d255bfc 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -116,8 +116,11 @@ class DumpCompiler(object):
if self._uninst_srcdir is not None:
gdump_path = os.path.join(self._uninst_srcdir, 'girepository', 'gdump.c')
else:
- gdump_path = os.path.join(os.path.join(DATADIR), 'gobject-introspection-1.0',
- 'gdump.c')
+ try:
+ gdump_path = GDUMP_PATH
+ except NameError:
+ gdump_path = os.path.join(os.path.join(DATADIR),
+ 'gobject-introspection-1.0', 'gdump.c')
if not os.path.isfile(gdump_path):
raise SystemExit("Couldn't find %r" % (gdump_path, ))
with open(gdump_path) as gdump_file: