From 261cbf2422c64a1376193664f3df711371019ace Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi Date: Wed, 12 Feb 2025 15:20:09 +0100 Subject: [PATCH] TST: extend local lib test to verify Windows support --- tests/packages/link-against-local-lib/__init__.py | 10 ++++++++++ tests/packages/link-against-local-lib/meson.build | 8 +++++++- tests/packages/link-against-local-lib/pyproject.toml | 3 +++ tests/test_wheel.py | 1 - 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 tests/packages/link-against-local-lib/__init__.py diff --git a/tests/packages/link-against-local-lib/__init__.py b/tests/packages/link-against-local-lib/__init__.py new file mode 100644 index 000000000..834d8f1ce --- /dev/null +++ b/tests/packages/link-against-local-lib/__init__.py @@ -0,0 +1,10 @@ +import os + +_path = os.path.join(os.path.dirname(__file__), '..', '.example.meson-libs') +if os.name == 'nt': + os.add_dll_directory(_path) +elif sys.platform == 'cygwin': + os.environ['PATH'] = os.pathsep.join((os.environ['PATH'], _path)) +del _path + +from _example import * diff --git a/tests/packages/link-against-local-lib/meson.build b/tests/packages/link-against-local-lib/meson.build index a45168cb4..ce2630e34 100644 --- a/tests/packages/link-against-local-lib/meson.build +++ b/tests/packages/link-against-local-lib/meson.build @@ -8,10 +8,16 @@ subdir('lib') py = import('python').find_installation() +py.install_sources( + '__init__.py', + subdir: 'example', +) + py.extension_module( - 'example', + '_example', 'examplemod.c', link_with: example_lib, link_args: ['-Wl,-rpath,custom-rpath'], install: true, + subdir: 'example', ) diff --git a/tests/packages/link-against-local-lib/pyproject.toml b/tests/packages/link-against-local-lib/pyproject.toml index 2542e4395..ef8c7eed6 100644 --- a/tests/packages/link-against-local-lib/pyproject.toml +++ b/tests/packages/link-against-local-lib/pyproject.toml @@ -5,3 +5,6 @@ [build-system] build-backend = 'mesonpy' requires = ['meson-python'] + +[tool.meson-python] +allow-windows-internal-shared-libs = true diff --git a/tests/test_wheel.py b/tests/test_wheel.py index 06dfc688f..5721ca79b 100644 --- a/tests/test_wheel.py +++ b/tests/test_wheel.py @@ -172,7 +172,6 @@ def test_contents(package_library, wheel_library): } -@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform') def test_local_lib(venv, wheel_link_against_local_lib): venv.pip('install', wheel_link_against_local_lib) output = venv.python('-c', 'import example; print(example.example_sum(1, 2))')