Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mesonpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion tests/packages/user-args/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ requires = ['meson-python']
dist = ['config-dist']
setup = ['config-setup']
compile = ['config-compile']
install = ['config-install']
install = ['--skip-subprojects=config']
15 changes: 7 additions & 8 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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'))
Expand Down
Loading