Skip to content

Commit eb4016f

Browse files
committed
ENH: warn on unhandled meson install arguments
1 parent 8d50078 commit eb4016f

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

mesonpy/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,10 @@ def _manifest(self) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]:
896896
parser = argparse.ArgumentParser(add_help=False)
897897
parser.add_argument('--tags')
898898
parser.add_argument('--skip-subprojects', nargs='?', const='*', default='')
899-
args, _ = parser.parse_known_args(self._meson_args['install'])
899+
args, others = parser.parse_known_args(self._meson_args['install'])
900+
if others:
901+
otherstr = ' '.join(others)
902+
warnings.warn(f'unhandled arguments specified for meson install: {otherstr}', stacklevel=1)
900903
install_tags = {t.strip() for t in args.tags.split(',')} if args.tags else None
901904
skip_subprojects = {p for p in (p.strip() for p in args.skip_subprojects.split(',')) if p}
902905

tests/packages/user-args/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ requires = ['meson-python']
1010
dist = ['config-dist']
1111
setup = ['config-setup']
1212
compile = ['config-compile']
13-
install = ['config-install']
13+
install = ['--skip-subprojects=config']

tests/test_project.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def wrapper(self, cmd):
202202
'dist-args': ('cli-dist',),
203203
'setup-args': ('cli-setup',),
204204
'compile-args': ('cli-compile',),
205-
'install-args': ('cli-install',),
205+
'install-args': ('--skip-subprojects=cli',),
206206
}
207207

208208
with in_git_repo_context():
@@ -224,16 +224,15 @@ def wrapper(self, cmd):
224224
# check that the user options are passed to the invoked commands
225225
expected = [
226226
# sdist: calls to 'meson setup' and 'meson dist'
227-
['config-setup', 'cli-setup'],
228-
['config-dist', 'cli-dist'],
227+
{'config-setup', 'cli-setup'},
228+
{'config-dist', 'cli-dist'},
229229
# wheel: calls to 'meson setup', 'meson compile', and 'meson install'
230-
['config-setup', 'cli-setup'],
231-
['config-compile', 'cli-compile'],
232-
['config-install', 'cli-install'],
230+
{'config-setup', 'cli-setup'},
231+
{'config-compile', 'cli-compile'},
232+
{'--skip-subprojects=config', '--skip-subprojects=cli'},
233233
]
234234
for expected_args, cmd_args in zip(expected, args):
235-
for arg in expected_args:
236-
assert arg in cmd_args
235+
assert expected_args.issubset(cmd_args)
237236

238237

239238
@pytest.mark.parametrize('package', ('top-level', 'meson-args'))

0 commit comments

Comments
 (0)