meson: Use env.prepend() for test environment setup

On NixOS packages are installed in separate prefixes.
Starting from GLib / gobject-introspection 2.80, GLib introspection data
is provided by GLib itself instead of gobject-introspection. This causes
tests failures on NixOS because env.set() resets the environment and GLib
is missing from GI_TYPELIB_PATH:

gi.RepositoryError: Typelib file for namespace 'Gio', version '2.0' not found

See also:
29e6cc5808
This commit is contained in:
Bobby Rong 2024-03-10 10:30:48 +08:00
parent a86c93d6f9
commit 2089893232
No known key found for this signature in database

View File

@ -257,8 +257,8 @@ if get_option('introspection')
# env to be used in tests that use the typelib,
# to make sure they find the one for MockService
test_typelib_env = environment()
test_typelib_env.set('GI_TYPELIB_PATH', meson.current_build_dir())
test_typelib_env.set('LD_LIBRARY_PATH', meson.current_build_dir())
test_typelib_env.prepend('GI_TYPELIB_PATH', meson.current_build_dir())
test_typelib_env.prepend('LD_LIBRARY_PATH', meson.current_build_dir())
# Python Tests
pytest_names = [