[gobject-introspection/wip/smcv/search-paths: 1/6] Python tools: Don't prepend /usr/share to the search path for GIR XML




commit 63666d662d39bfe38b83eeccef66376b52791932
Author: Simon McVittie <smcv debian org>
Date:   Wed Feb 10 10:39:16 2021 +0000

    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).
    
    Signed-off-by: Simon McVittie <smcv debian org>
    
    Gbp-Pq: Name Python-tools-Don-t-prepend-usr-share-to-the-search-path-f.patch

 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 75bf759c..f8fd2d33 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'))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]