Skip to content

Support Python 3.8.x+ on Windows

Chun-wei Fan requested to merge py38.windows into master

Hi,

This is an attempt to fix G-I building and running on Windows and Python 3.8.x and later, as there are changes in there on how DLLs are located and loaded. This attempts to fix this by using os.add_dll_directory() with the paths given by the following methods:

  • Adding an envvar GI_EXTRA_BASE_DLL_DIRS to point to paths where we could find dependent DLLs that are not in the paths we have from pkg-config --variable bindir (as below), as necessary.

  • Also look for the paths returned by pkg-config --variable bindir. Note that this takes precedence over the paths given by GI_EXTRA_BASE_DLL_DIRS, and this approach is used also for initialization, as _giscanner.pyd will require at least the GObject and GLib DLLs (via using gio-2.0.pc [not gobject-2.0.pc, since it has no bindir entry]).

This approach avoids injecting paths from %PATH%.

This fixes issue #324 (closed).

With blessings, thank you!

Merge request reports