Skip to content

Commit e58ac01

Browse files
committed
CI: run tests with MSVC too
1 parent 5e5d1d5 commit e58ac01

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

.github/workflows/tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,44 @@ jobs:
104104
env_vars: PYTHON
105105
name: ${{ matrix.python }}
106106

107+
msvc:
108+
runs-on: windows-latest
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
python:
113+
- '3.11'
114+
meson:
115+
-
116+
117+
steps:
118+
- name: Checkout
119+
uses: actions/checkout@v3
120+
121+
- name: Set up target Python
122+
uses: actions/setup-python@v4
123+
with:
124+
python-version: ${{ matrix.python }}
125+
126+
- name: Install Ninja
127+
run: python -m pip --disable-pip-version-check install ninja
128+
129+
- name: Setup MSVC
130+
uses: bus1/cabuild/action/msdevshell@v1
131+
with:
132+
architecture: x64
133+
134+
- name: Install Meson
135+
run: python -m pip --disable-pip-version-check install "meson==${{ matrix.meson }}"
136+
if: ${{ matrix.meson }}
137+
138+
- name: Install
139+
run: python -m pip --disable-pip-version-check install .[test]
140+
141+
- name: Run tests
142+
run: >-
143+
python -m pytest --showlocals -vv
144+
107145
cygwin:
108146
runs-on: windows-latest
109147
strategy:

mesonpy/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def top_level_modules(self) -> Collection[str]:
392392
break
393393
else: # nobreak
394394
# skip Windows import libraries
395-
if top_part.endswith('.a'):
395+
if top_part.endswith(('.dll.a', '.lib')):
396396
continue
397397
# package module
398398
modules.add(top_part)
@@ -421,7 +421,7 @@ def _is_native(self, file: Union[str, pathlib.Path]) -> bool:
421421
return True
422422
return False
423423

424-
def _install_path(
424+
def _install_path( # noqa: C901
425425
self,
426426
wheel_file: mesonpy._wheelfile.WheelFile,
427427
counter: mesonpy._util.CLICounter,
@@ -476,7 +476,13 @@ def _install_path(
476476
raise NotImplementedError("Bundling libraries in wheel is not supported on platform '{}'"
477477
.format(platform.system()))
478478

479-
wheel_file.write(origin, location)
479+
try:
480+
wheel_file.write(origin, location)
481+
except FileNotFoundError:
482+
if os.fspath(origin).endswith('.pdb'):
483+
# work around for Meson bug
484+
pass
485+
raise
480486

481487
def _wheel_write_metadata(self, whl: mesonpy._wheelfile.WheelFile) -> None:
482488
# add metadata

tests/test_wheel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import platform
66
import re
7+
import shutil
78
import stat
89
import subprocess
910
import sys
@@ -28,7 +29,8 @@
2829
from distutils.sysconfig import get_config_var
2930
EXT_SUFFIX = get_config_var('EXT_SUFFIX')
3031

31-
EXT_IMP_SUFFIX = re.sub(r'.pyd$', '.dll', EXT_SUFFIX) + '.a'
32+
if sys.platform in {'win32', 'cygwin'}:
33+
EXT_IMP_SUFFIX = re.sub(r'.(pyd|dll)$', '.lib' if shutil.which('cl.exe') else '.dll.a', EXT_SUFFIX)
3234

3335
# Test against the wheel tag generated by packaging module.
3436
tag = next(packaging.tags.sys_tags())

0 commit comments

Comments
 (0)