diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-01-15 15:32:38 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-01-16 12:20:06 +0800 |
commit | d14923f6c52e4747658c1b58766103fe6c207b40 (patch) | |
tree | a44a7b228d408c592f3ba7e647ca90a035a8d339 /giscanner/dumper.py | |
parent | ad937bca10be979cc468b8da0d31f40f86ce0851 (diff) | |
download | gobject-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/dumper.py')
-rw-r--r-- | giscanner/dumper.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/giscanner/dumper.py b/giscanner/dumper.py index 61942faf..0c10a780 100644 --- a/giscanner/dumper.py +++ b/giscanner/dumper.py @@ -252,6 +252,9 @@ class DumpCompiler(object): for ldflag in shlex.split(os.environ.get('LDFLAGS', '')): args.append(ldflag) + dll_dirs = utils.dll_dirs() + dll_dirs.add_dll_dirs(self._packages) + if not self._options.quiet: print("g-ir-scanner: link: %s" % ( subprocess.list2cmdline(args), )) @@ -278,6 +281,7 @@ class DumpCompiler(object): finally: if msys: os.remove(tf_name) + dll_dirs.cleanup_dll_dirs() def compile_introspection_binary(options, get_type_functions, |