summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.flake82
-rw-r--r--Makefile-tools.am2
-rw-r--r--giscanner/transformer.py1
-rw-r--r--tests/warn/warningtester.py1
-rwxr-xr-xtools/g-ir-tool-template.in10
-rw-r--r--tools/meson.build1
6 files changed, 15 insertions, 2 deletions
diff --git a/.flake8 b/.flake8
index 9c8621cf..cda7132a 100644
--- a/.flake8
+++ b/.flake8
@@ -1,4 +1,4 @@
[flake8]
ignore=E127,E402,E501,E731,E128,W503,E741
exclude=misc,subprojects
-builtins=DATADIR
+builtins=DATADIR,GIRDIR
diff --git a/Makefile-tools.am b/Makefile-tools.am
index c70d9850..fcaf1e01 100644
--- a/Makefile-tools.am
+++ b/Makefile-tools.am
@@ -9,7 +9,7 @@ EXTRA_DIST += \
tools/g-ir-tool-template.in \
tools/meson.build
-TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON_CMD\@,\/usr\/bin\/env\ $(PYTHON),
+TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON_CMD\@,\/usr\/bin\/env\ $(PYTHON), -e s,@GIR_DIR\@,$(GIR_DIR),g
g-ir-scanner: tools/g-ir-tool-template.in _giscanner.la Makefile
$(AM_V_GEN) sed $(TOOL_SUBSTITUTIONS) -e s,@TOOL_MODULE\@,scannermain, -e s,@TOOL_FUNCTION\@,scanner_main, $< > $@.tmp && mv $@.tmp $@
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 335e229f..2c412339 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -184,6 +184,7 @@ None."""
def _get_gi_data_dirs(self):
data_dirs = utils.get_system_data_dirs()
data_dirs.append(DATADIR)
+ data_dirs.append(GIRDIR)
if os.name != 'nt':
# For backwards compatibility, was always unconditionally added to the list.
data_dirs.append('/usr/share')
diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py
index f17c8889..be5aec13 100644
--- a/tests/warn/warningtester.py
+++ b/tests/warn/warningtester.py
@@ -18,6 +18,7 @@ sys.path.insert(0, path)
# Not correct, but enough to get the tests going uninstalled
builtins.__dict__['DATADIR'] = path
+builtins.__dict__['GIRDIR'] = ''
from giscanner.annotationparser import GtkDocCommentBlockParser
from giscanner.ast import Include, Namespace
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index ed33d16b..b9cf0911 100755
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -60,6 +60,16 @@ if not os.path.isdir(os.path.join(datadir, 'gir-1.0')):
builtins.__dict__['DATADIR'] = datadir
+# Respect gir_dir_prefix for meson and autotools
+girdir = ''
+# for meson
+if '@gir_dir_prefix@' and not '@gir_dir_prefix@'.startswith('@'):
+ girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@'))
+# for autotools
+elif '@GIR_DIR@' and not '@GIR_DIR@'.startswith('@'):
+ girdir = os.path.dirname(os.path.abspath('@GIR_DIR@'))
+builtins.__dict__['GIRDIR'] = girdir
+
# Again, relative paths first so that the installation prefix is relocatable
pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection'))
diff --git a/tools/meson.build b/tools/meson.build
index 912eb6ba..b45ce668 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -20,6 +20,7 @@ foreach tool : tools
tools_conf = configuration_data()
tools_conf.set('libdir', libdir_abs)
tools_conf.set('datarootdir', datadir_abs)
+ tools_conf.set('gir_dir_prefix', gir_dir_prefix)
tools_conf.set('PYTHON_CMD', python_cmd)
tools_conf.set('TOOL_MODULE', tool[1])