summaryrefslogtreecommitdiff
path: root/giscanner/pkgconfig.py
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 /giscanner/pkgconfig.py
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 'giscanner/pkgconfig.py')
-rw-r--r--giscanner/pkgconfig.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/giscanner/pkgconfig.py b/giscanner/pkgconfig.py
index 6f0b2d57..66822378 100644
--- a/giscanner/pkgconfig.py
+++ b/giscanner/pkgconfig.py
@@ -56,3 +56,12 @@ def libs(packages, msvc_syntax=False, ignore_errors=True, command=None):
flags.extend(packages)
out = check_output(flags, ignore_errors, command)
return shlex.split(out)
+
+
+def bindir(packages, ignore_errors=True, command=None):
+ flags = []
+ flags.append('--variable')
+ flags.append('bindir')
+ flags.extend(packages)
+ out = check_output(flags, ignore_errors, command)
+ return shlex.split(out)