ges: Fix Python library name fetching on Windows

The fix in 753aeccde7 is also needed here.

See #3368

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8199>
This commit is contained in:
L. E. Segovia 2024-12-22 11:14:45 -03:00 committed by GStreamer Marge Bot
parent 1485a387a4
commit 06192c125b

View file

@ -176,34 +176,50 @@ elif build_gir and python.found()
fsmod = import('fs') fsmod = import('fs')
pylib_prefix = 'lib' pylib_prefix = 'lib'
pylib_suffix = 'so' pylib_suffix = 'so'
pylib_ver = python_dep.version()
pylib_locs = []
if host_system == 'windows' if host_system == 'windows'
if cc.get_argument_syntax() == 'msvc' if cc.get_argument_syntax() == 'msvc'
pylib_prefix = '' pylib_prefix = ''
endif endif
pylib_suffix = 'dll' pylib_suffix = 'dll'
pylib_ver = pylib_ver.replace('.', '')
elif host_system == 'darwin' elif host_system == 'darwin'
pylib_suffix = 'dylib' pylib_suffix = 'dylib'
endif endif
pylib_fnames = [] pylib_fnames = []
# Library name with soversion, non-devel package # Library name with soversion, non-devel package
pylib_fnames += python.get_variable('INSTSONAME', []) if python.has_variable('INSTSONAME')
pylib_fnames += python.get_variable('INSTSONAME')
endif
# Library name without soversion, devel package, framework, etc. # Library name without soversion, devel package, framework, etc.
pylib_fnames += python.get_variable('LDLIBRARY', []) if python.has_variable('LDLIBRARY')
pylib_fnames += python.get_variable('LDLIBRARY')
endif
# Manually construct name as a fallback # Manually construct name as a fallback
pylib_fnames += [ pylib_fnames += [
pylib_prefix + 'python' + python_dep.version() + python_abi_flags + '.' + pylib_suffix pylib_prefix + 'python' + pylib_ver + python_abi_flags + '.' + pylib_suffix
] ]
if pylib_loc != '' if pylib_loc != ''
pylib_locs = [pylib_loc] pylib_locs = [pylib_loc]
else else
pylib_locs = [ if python.has_variable('LIBDIR')
python.get_variable('LIBDIR', ''), pylib_locs += python.get_variable('LIBDIR')
python.get_variable('LIBPL', ''), endif
] if python.has_variable('LIBPL')
pylib_locs += python.get_variable('LIBPL')
endif
# On Windows, python312.dll is in the rootdir where Python is installed,
# which is configured as the "prefix" in sysconfig.
if host_system == 'windows'
pylib_locs += python.get_variable('prefix')
endif
endif endif
foreach loc: pylib_locs foreach loc: pylib_locs
foreach fname: pylib_fnames foreach fname: pylib_fnames
if fsmod.exists(loc / fname) fpath = loc / fname
debug(f'Looking for Python library at: @fpath@')
if fsmod.exists(fpath)
libges_deps = libges_deps + [python_dep, gmodule_dep, libdl] libges_deps = libges_deps + [python_dep, gmodule_dep, libdl]
has_python = true has_python = true
cdata.set('HAS_PYTHON', true) cdata.set('HAS_PYTHON', true)
@ -214,12 +230,7 @@ elif build_gir and python.found()
endforeach endforeach
endforeach endforeach
if not has_python if not has_python
error_msg = 'Could not find python library to load' message('Could not find python library to load, will try loading at runtime')
if python_opt.enabled()
error(error_msg)
else
message(error_msg)
endif
endif endif
endif endif
endif endif