Skip to content

Add --skip-if-not-found to meson install #14551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion mesonbuild/minstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ArgumentType(Protocol):
destdir: str
dry_run: bool
skip_subprojects: str
skip_if_not_found: bool
tags: str
strip: bool

Expand Down Expand Up @@ -82,6 +83,8 @@ def add_arguments(parser: argparse.ArgumentParser) -> None:
help='Doesn\'t actually install, but print logs. (Since 0.57.0)')
parser.add_argument('--skip-subprojects', nargs='?', const='*', default='',
help='Do not install files from given subprojects. (Since 0.58.0)')
parser.add_argument('--skip-if-not-found', action='store_true',
help='Skip installing target if it was not built. (Since 1.9.0)')
parser.add_argument('--tags', default=None,
help='Install only targets having one of the given tags. (Since 0.60.0)')
parser.add_argument('--strip', action='store_true',
Expand Down Expand Up @@ -313,6 +316,7 @@ def __init__(self, options: 'ArgumentType', lf: T.TextIO):
# ['*'] means skip all,
# ['sub1', ...] means skip only those.
self.skip_subprojects = [i.strip() for i in options.skip_subprojects.split(',')]
self.skip_if_not_found = options.skip_if_not_found
self.tags = [i.strip() for i in options.tags.split(',')] if options.tags else None

def remove(self, *args: T.Any, **kwargs: T.Any) -> None:
Expand Down Expand Up @@ -747,7 +751,7 @@ def install_targets(self, d: InstallData, dm: DirMaker, destdir: str, fullprefix
continue
if not os.path.exists(t.fname):
# For example, import libraries of shared modules are optional
if t.optional:
if t.optional or self.skip_if_not_found:
self.log(f'File {t.fname!r} not found, skipping')
continue
else:
Expand Down
Loading