Skip to content

Further fixes to running the g-ir-* Python scripts on Windows on Python 3.8.x+

Chun-wei Fan requested to merge fix-further-running-py38 into main

Hi,

Due to changes in !443 (merged) and libgirepository being moved to GLib, the build files need to be updated to do the following:

  • If GLib (and thus libffi, as it is a dependency of GObject) is found with pkg-config by setting -Dpkg_config_path=... (or --pkg-config-path=...) rather than using PKG_CONFIG_PATH, make sure that this option is honored when building the .gir files and when running the tests on Windows. This is necessary as the script uses the results of querying the GLib's pkg-config files to find the paths where the GLib DLLs can be found, to feed into os.add_dll_directory() on Python 3.8.x or later, so that the scripts can run, as Python-3.8.x or later on Windows only loads DLLs from designated system paths and the paths that were explicitly marked with os.add_dll_directory().
  • Otherwise, if GLib and/or libffi is built as a subproject , add all of its subdirs(glib, gobject, gio, gmodule, libffi, and possibly PCRE, ZLib and proxy-intl) into an envvar GI_EXTRA_BASE_DLL_DIRS, that is also used for os.add_dll_directory(),, set an envvar GLIB_BUILD_DIR, which will (if not already done so) set PKG_CONFIG_PATH to look first for the uninstalled gio-2.0-uninstalled.pc, and then the paths in %PATH%, so that the freshly-built GLib DLLs and their dependent DLLs can also be loaded.

This will fix building the various introspection files as well as the tests in regards to loading the dependent DLLs for the g-ir-* script, for G-I.

This will fix #499 (closed) on the gobject-introspection side.

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports