Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 555bd6d

Browse filesBrowse files
committed
TST: extend local lib test to verify Windows support
1 parent 900b5cf commit 555bd6d
Copy full SHA for 555bd6d

File tree

Expand file treeCollapse file tree

5 files changed

+35
-7
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+35
-7
lines changed
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-FileCopyrightText: 2025 The meson-python developers
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
import os
6+
import sys
7+
8+
9+
_path = os.path.join(os.path.dirname(__file__), '..', '.link_against_local_lib.mesonpy.libs')
10+
if os.name == 'nt':
11+
os.add_dll_directory(_path)
12+
elif sys.platform == 'cygwin':
13+
os.environ['PATH'] = os.pathsep.join((os.environ['PATH'], _path))
14+
del _path
15+
16+
17+
from ._example import example_sum # noqa: E402
18+
19+
20+
__all__ = ['example_sum']

‎tests/packages/link-against-local-lib/examplemod.c

Copy file name to clipboardExpand all lines: tests/packages/link-against-local-lib/examplemod.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ static PyMethodDef methods[] = {
2525

2626
static struct PyModuleDef module = {
2727
PyModuleDef_HEAD_INIT,
28-
"example",
28+
"_example",
2929
NULL,
3030
-1,
3131
methods,
3232
};
3333

34-
PyMODINIT_FUNC PyInit_example(void)
34+
PyMODINIT_FUNC PyInit__example(void)
3535
{
3636
return PyModule_Create(&module);
3737
}

‎tests/packages/link-against-local-lib/meson.build

Copy file name to clipboardExpand all lines: tests/packages/link-against-local-lib/meson.build
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ project('link-against-local-lib', 'c', version: '1.0.0')
66

77
subdir('lib')
88

9-
py = import('python').find_installation()
9+
py = import('python').find_installation(pure: false)
10+
11+
py.install_sources(
12+
'__init__.py',
13+
subdir: 'example',
14+
)
1015

1116
py.extension_module(
12-
'example',
17+
'_example',
1318
'examplemod.c',
1419
link_with: example_lib,
1520
link_args: ['-Wl,-rpath,custom-rpath'],
1621
install: true,
22+
subdir: 'example',
1723
)

‎tests/packages/link-against-local-lib/pyproject.toml

Copy file name to clipboardExpand all lines: tests/packages/link-against-local-lib/pyproject.toml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
[build-system]
66
build-backend = 'mesonpy'
77
requires = ['meson-python']
8+
9+
[tool.meson-python]
10+
allow-windows-internal-shared-libs = true

‎tests/test_wheel.py

Copy file name to clipboardExpand all lines: tests/test_wheel.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ def test_contents(package_library, wheel_library):
172172
}
173173

174174

175-
@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')
176175
def test_local_lib(venv, wheel_link_against_local_lib):
177176
venv.pip('install', wheel_link_against_local_lib)
178177
output = venv.python('-c', 'import example; print(example.example_sum(1, 2))')
@@ -200,9 +199,9 @@ def test_rpath(wheel_link_against_local_lib, tmp_path):
200199
artifact.extractall(tmp_path)
201200

202201
origin = {'linux': '$ORIGIN', 'darwin': '@loader_path', 'sunos5': '$ORIGIN'}[sys.platform]
203-
expected = {f'{origin}/.link_against_local_lib.mesonpy.libs', 'custom-rpath',}
202+
expected = {f'{origin}/../.link_against_local_lib.mesonpy.libs', 'custom-rpath',}
204203

205-
rpath = set(mesonpy._rpath._get_rpath(tmp_path / f'example{EXT_SUFFIX}'))
204+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'example' / f'_example{EXT_SUFFIX}'))
206205
# Verify that rpath is a superset of the expected one: linking to
207206
# the Python runtime may require additional rpath entries.
208207
assert rpath >= expected

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.