mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
tests: Expand PATH for Python tests on Windows
This works around a Meson bug
(https://github.com/mesonbuild/meson/issues/4668).
If we have a Python test which spawns a built native binary, that binary is
listed in the `depends` argument of the `test()`. On Linux, this results in
the directories containing the built libraries which the binary depends on
being added to the `LD_LIBRARY_PATH` of the test invocation. On Windows,
however, Meson currently doesn’t add those directories to `PATH` (which is
the equivalent of `LD_LIBRARY_PATH`), so we have to do it manually.
This takes the same approach as Christoph Reiter did in
gobject-introspection
(13e8c7ff80/tests/meson.build (L2)
).
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
@@ -1176,6 +1176,9 @@ endforeach
|
||||
python_test_env = test_env
|
||||
python_test_env.prepend('PYTHONPATH', python_test_libraries_path)
|
||||
python_test_env.prepend('PYTHONPATH', python_test_libraries_built)
|
||||
if python_test_env_common_path.length() > 0
|
||||
python_test_env.prepend('PATH', python_test_env_common_path)
|
||||
endif
|
||||
|
||||
foreach test_name, extra_args : python_tests
|
||||
depends = [extra_args.get('depends', [])]
|
||||
|
@@ -187,6 +187,9 @@ endif
|
||||
python_test_env = test_env
|
||||
python_test_env.prepend('PYTHONPATH', python_test_libraries_path)
|
||||
python_test_env.prepend('PYTHONPATH', python_test_libraries_built)
|
||||
if python_test_env_common_path.length() > 0
|
||||
python_test_env.prepend('PATH', python_test_env_common_path)
|
||||
endif
|
||||
|
||||
foreach test_name, extra_args : python_tests
|
||||
depends = [extra_args.get('depends', [])]
|
||||
|
@@ -515,6 +515,9 @@ endif
|
||||
python_test_env = test_env
|
||||
python_test_env.prepend('PYTHONPATH', python_test_libraries_path)
|
||||
python_test_env.prepend('PYTHONPATH', python_test_libraries_built)
|
||||
if python_test_env_common_path.length() > 0
|
||||
python_test_env.prepend('PATH', python_test_env_common_path)
|
||||
endif
|
||||
|
||||
foreach test_name, extra_args : python_tests
|
||||
depends = [extra_args.get('depends', [])]
|
||||
|
@@ -235,6 +235,9 @@ endforeach
|
||||
python_test_env = test_env
|
||||
python_test_env.prepend('PYTHONPATH', python_test_libraries_path)
|
||||
python_test_env.prepend('PYTHONPATH', python_test_libraries_built)
|
||||
if python_test_env_common_path.length() > 0
|
||||
python_test_env.prepend('PATH', python_test_env_common_path)
|
||||
endif
|
||||
|
||||
foreach test_name, extra_args : python_tests
|
||||
depends = [extra_args.get('depends', [])]
|
||||
|
20
meson.build
20
meson.build
@@ -2516,6 +2516,26 @@ if not python_version.version_compare(python_version_req)
|
||||
endif
|
||||
python_test_libraries_built = meson.project_build_root() / 'tests' / 'lib'
|
||||
|
||||
# FIXME: https://github.com/mesonbuild/meson/issues/4668
|
||||
#
|
||||
# If we have a Python test which spawns a built native binary, that binary is
|
||||
# listed in the `depends` argument of the `test()`. On Linux, this results in
|
||||
# the directories containing the built libraries which the binary depends on
|
||||
# being added to the `LD_LIBRARY_PATH` of the test invocation. On Windows,
|
||||
# however, Meson currently doesn’t add those directories to `PATH` (which is the
|
||||
# equivalent of `LD_LIBRARY_PATH`), so we have to do it manually.
|
||||
python_test_env_common_path = []
|
||||
if host_system == 'windows'
|
||||
build_root = meson.project_build_root()
|
||||
python_test_env_common_path += [
|
||||
build_root / 'gmodule',
|
||||
build_root / 'girepository',
|
||||
build_root / 'gio',
|
||||
build_root / 'glib',
|
||||
build_root / 'gobject',
|
||||
]
|
||||
endif
|
||||
|
||||
# Determine which user environment-dependent files that we want to install
|
||||
bash = find_program('bash', required : false)
|
||||
have_bash = bash.found() # For completion scripts
|
||||
|
Reference in New Issue
Block a user