summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2020-01-15 15:32:38 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2020-01-16 12:20:06 +0800
commitd14923f6c52e4747658c1b58766103fe6c207b40 (patch)
treea44a7b228d408c592f3ba7e647ca90a035a8d339 /tools
parentad937bca10be979cc468b8da0d31f40f86ce0851 (diff)
downloadgobject-introspection-d14923f6c52e4747658c1b58766103fe6c207b40.tar.gz
Windows: Fix building and running on Python 3.8+
Python 3.8.x and later changed the way how dependent DLLs can be found for a given Python module that depends on the presence of external, non-system DLLs, for more fine-grained DLLs searching and loading, as well as for security purposes, which required the use of os.add_dll_directory(). Thus, the scripts in scanner/ must be updated such that: -We are able to find and load the GObject and GLib DLLs, at least, on initialization, via the use of 'pkg-config --variable bindir', as we already depend on the GLib DLLs. Note that since the gobject-2.0.pc file does not have a 'bindir' entry, we use gio-2.0.pc instead to discover the bindir of the GObject and GLib DLLs. Likewise, we use the same technique for pkg-config files that are dependent upon when using g-ir-scanner (or friends) on items that are higher up in the stack. -We are able to find any other DLLs (e.g. non-GNOME DLLs such as ZLib) that are dependent but are not found in the path(s) given by 'pkg-config --variable bindir' with the envvar GI_EXTRA_BASE_DLL_DIRS, as needed. Note that GI_EXTRA_BASE_DLL_DIRS can be multiple paths, and that the results from 'pkg-config --variable bindir' takes precendence, in a LIFO manner.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/g-ir-tool-template.in4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index 8462f88a..c4a10a28 100755
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -96,5 +96,9 @@ if not os.path.isfile(os.path.join(pylibdir, 'giscanner', '_giscanner' + py_mod_
sys.path.insert(0, pylibdir)
+from giscanner.utils import dll_dirs
+dll_dirs = dll_dirs()
+dll_dirs.add_dll_dirs(['gio-2.0'])
+
from giscanner.@TOOL_MODULE@ import @TOOL_FUNCTION@
sys.exit(@TOOL_FUNCTION@(sys.argv))