diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py index d4dd3bd08..abbef564c 100644 --- a/mesonpy/__init__.py +++ b/mesonpy/__init__.py @@ -896,7 +896,10 @@ def _manifest(self) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]: parser = argparse.ArgumentParser(add_help=False) parser.add_argument('--tags') parser.add_argument('--skip-subprojects', nargs='?', const='*', default='') - args, _ = parser.parse_known_args(self._meson_args['install']) + args, others = parser.parse_known_args(self._meson_args['install']) + if others: + otherstr = ' '.join(others) + warnings.warn(f'unhandled arguments specified for meson install: {otherstr}', stacklevel=1) install_tags = {t.strip() for t in args.tags.split(',')} if args.tags else None skip_subprojects = {p for p in (p.strip() for p in args.skip_subprojects.split(',')) if p} diff --git a/tests/packages/user-args/pyproject.toml b/tests/packages/user-args/pyproject.toml index fd626ad36..f2a4aad7e 100644 --- a/tests/packages/user-args/pyproject.toml +++ b/tests/packages/user-args/pyproject.toml @@ -10,4 +10,4 @@ requires = ['meson-python'] dist = ['config-dist'] setup = ['config-setup'] compile = ['config-compile'] -install = ['config-install'] +install = ['--skip-subprojects=config'] diff --git a/tests/test_project.py b/tests/test_project.py index fb3d08084..11b229ab7 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -202,7 +202,7 @@ def wrapper(self, cmd): 'dist-args': ('cli-dist',), 'setup-args': ('cli-setup',), 'compile-args': ('cli-compile',), - 'install-args': ('cli-install',), + 'install-args': ('--skip-subprojects=cli',), } with in_git_repo_context(): @@ -224,16 +224,15 @@ def wrapper(self, cmd): # check that the user options are passed to the invoked commands expected = [ # sdist: calls to 'meson setup' and 'meson dist' - ['config-setup', 'cli-setup'], - ['config-dist', 'cli-dist'], + {'config-setup', 'cli-setup'}, + {'config-dist', 'cli-dist'}, # wheel: calls to 'meson setup', 'meson compile', and 'meson install' - ['config-setup', 'cli-setup'], - ['config-compile', 'cli-compile'], - ['config-install', 'cli-install'], + {'config-setup', 'cli-setup'}, + {'config-compile', 'cli-compile'}, + {'--skip-subprojects=config', '--skip-subprojects=cli'}, ] for expected_args, cmd_args in zip(expected, args): - for arg in expected_args: - assert arg in cmd_args + assert expected_args.issubset(cmd_args) @pytest.mark.parametrize('package', ('top-level', 'meson-args'))