meson: Fix docs generation with PyGObject 3.52

PyGObject 3.52 switched from gobject-introspection’s libgirepository 1.0
to glib’s libgirepository 2.0. As a result, the Python script would
no longer be able to find the `GIRepository` 2.0 typelib:

    (process:1944): GLib-GIRepository-DEBUG: 15:25:14.521: Ignoring GIRepository-2.0.typelib because this libgirepository corresponds to GIRepository-3.0.typelib

We could update the script to support both versions of the typelib
but it is not really necessary. It was only used to add extra directories
from `$LD_LIBRARY_PATH` and the CLI argument to repository’s library path
but libgirepository already supports using `LD_LIBRARY_PATH` directly:
https://docs.gtk.org/girepository/method.Repository.prepend_library_path.html
This commit is contained in:
Jan Tojnar
2025-03-23 16:35:44 +01:00
committed by Beniamino Galvani
parent ecce8fa461
commit 12eff9a7fd
2 changed files with 0 additions and 29 deletions

View File

@@ -209,7 +209,6 @@ if enable_introspection
'LD_LIBRARY_PATH=' + ld_library_path,
python_path,
gen_gir_cmd,
'--lib-path', meson.current_build_dir(),
'--gir', libnm_gir[0],
'--output', '@OUTPUT@',
'--target', name

View File

@@ -6,26 +6,9 @@
from __future__ import print_function, unicode_literals
import xml.etree.ElementTree as ET
import argparse
import os
import gi
import re
gi.require_version("GIRepository", "2.0")
from gi.repository import GIRepository
try:
libs = os.environ["LD_LIBRARY_PATH"].split(":")
libs.reverse()
for lib in libs:
GIRepository.Repository.prepend_library_path(lib)
except AttributeError:
# An old GI version, that has no prepend_library_path
# It's alright, it probably interprets LD_LIBRARY_PATH
# correctly.
pass
except KeyError:
pass
gi.require_version("NM", "1.0")
from gi.repository import NM, GObject
@@ -354,13 +337,6 @@ def main(gir_path_str, output_path_str, output_target):
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-l",
"--lib-path",
metavar="PATH",
action="append",
help="path to scan for shared libraries",
)
parser.add_argument(
"-g",
"--gir",
@@ -384,8 +360,4 @@ if __name__ == "__main__":
args = parser.parse_args()
if args.lib_path:
for lib in args.lib_path:
GIRepository.Repository.prepend_library_path(lib)
main(args.gir, args.output, args.target)