Skip to content

Commit 65fd7c4

Browse files
coolcatco888bwoodsend
authored andcommitted
Fix msys2 dll paths in GdkPixbuf loaders.cache gen (#7842)
1 parent 1e8484b commit 65fd7c4

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎PyInstaller/hooks/hook-gi.repository.GdkPixbuf.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _collect_loaders(libdir):
5252

5353
# Sometimes the loaders are stored in a different directory from the library (msys2)
5454
if not loader_libs:
55-
pattern = os.path.join(libdir, '..', 'lib', LOADERS_PATH, lib_ext)
55+
pattern = os.path.abspath(os.path.join(libdir, '..', 'lib', LOADERS_PATH, lib_ext))
5656
for f in glob.glob(pattern):
5757
loader_libs.append(f)
5858

@@ -89,6 +89,9 @@ def _generate_loader_cache(gdk_pixbuf_query_loaders, libdir, loader_libs):
8989
win_prefix = '"' + '\\\\'.join(['lib', 'gdk-pixbuf-2.0', '2.10.0'])
9090
win_plen = len(win_prefix)
9191

92+
msys2_prefix = '"' + os.path.abspath(os.path.join(libdir, '..', 'lib', 'gdk-pixbuf-2.0', '2.10.0'))
93+
msys2_plen = len(msys2_prefix)
94+
9295
# For each line in the updated loader cache...
9396
for line in cachedata.splitlines():
9497
if line.startswith('#'):
@@ -97,6 +100,8 @@ def _generate_loader_cache(gdk_pixbuf_query_loaders, libdir, loader_libs):
97100
line = '"@executable_path/' + LOADER_CACHE_DEST_PATH + line[plen:]
98101
elif line.startswith(win_prefix):
99102
line = '"' + LOADER_CACHE_DEST_PATH.replace('/', '\\\\') + line[win_plen:]
103+
elif line.startswith(msys2_prefix):
104+
line = ('"' + LOADER_CACHE_DEST_PATH + line[msys2_plen:]).replace('/', '\\\\')
100105
output_lines.append(line)
101106

102107
return '\n'.join(output_lines)

‎news/7842.bugfix.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(Windows) Fixed bug where GdkPixbuf loaders.cache dll paths are absolute
2+
paths (eg. ``C:/tools/msys64/mingw64/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.dll``)
3+
and not relative paths (eg. ``lib\\gdk-pixbuf\\loaders\\libpixbufloader-png.dll``)
4+
when the file is generated in the msys2/mingw64 environment. This results in
5+
the program crashing when run on another Windows machine because it cannot find the
6+
GdkPixbuf loader dlls.

0 commit comments

Comments
 (0)