Skip to content

utils.py: Improve .gir search on Windows

Chun-wei Fan requested to merge msvc into main

On Windows, we tend to look for .gir files in the $(prefix) directory indicated by $(prefix)/bin/g-ir-scanner when running g-ir-scanner, so:

  • We add a special case for find_program() to look for g-ir-scanner on Windows without any executable extensions, since that is how g-ir-scanner is being deployed as a Python script.

  • Update default_search_paths() to first look for the presence of g-ir-scanner, and use its "installation prefix" to construct the default path where g-ir-scanner looks for the .gir files.

This way, we can make gi-docgen work better on Visual Studio builds where Python (i.e. the official binary installers from www.python.org) is generally installed seperately from the $(prefix) of our GNOME stack, meaning that we can reduce the need to copy the dependent .gir files from under our $(prefix).

With blessings, thank you!

Merge request reports