From 98aa7b1c6e64e076d869221381b39a28c2bae774 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 10 Feb 2021 10:39:16 +0000 Subject: Python tools: Don't prepend /usr/share to the search path for GIR XML This code was presumably intended to add a relocatable path ${bindir}/../${gir_dir_prefix}/gir-1.0 to the search path, where ${bindir} is computed at runtime and ${gir_dir_prefix} is hard-coded at configure time. However, this didn't work as intended for two reasons: * the gir-1.0 suffix was missing, so in practice we would look for GIR XML in a location like /usr/share/Gio-2.0.gir or /usr/lib64/Gio-2.0.gir, not find it, and proceed to the next search path entry; * the @gir_dir_prefix@ substituted from the build system is currently an absolute path, so os.path.join would discard ${bindir}/.. and use the compile-time @gir_dir_prefix@ as-is If this had worked as intended, its precedence would also have been inconsistent with the C code: the Python code searches GIRDIR before the XDG_DATA_DIRS, but the C code searches its direct equivalent, GIR_DIR, after the XDG_DATA_DIRS. Since this doesn't seem to be doing anything useful, discard it. This leaves builtins.GIRDIR set to either empty (normally) or just the ${srcdir}/gir/ (when running uninstalled). Helps: #323, #455 Signed-off-by: Simon McVittie --- tools/g-ir-tool-template.in | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in index 6e98f52e..b8f67913 100755 --- a/tools/g-ir-tool-template.in +++ b/tools/g-ir-tool-template.in @@ -52,11 +52,7 @@ if not os.path.isdir(os.path.join(datadir, 'gir-1.0')): datadir = "@datarootdir@" builtins.__dict__['DATADIR'] = datadir - -# Respect gir_dir_prefix -girdir = '' -girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@')) -builtins.__dict__['GIRDIR'] = [girdir] +builtins.__dict__['GIRDIR'] = [] # Again, relative paths first so that the installation prefix is relocatable pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection')) -- cgit v1.2.1