Reduce an indent level in the install for loop
if not t.should_install(): continue
No logic changes at all.
Also improve the message when erroring out about insufficient
install_dir: list elements.
@@ -628,8 +628,8 @@ int dummy;
def generate_target_install(self, d):
for t in self.build.get_targets().values():
- if t.should_install():
- should_strip = self.get_option_for_target('strip', t)
+ if not t.should_install():
+ continue
# Find the installation directory.
outdirs = t.get_custom_install_dir()
custom_install_dir = False
@@ -651,11 +651,13 @@ int dummy;
# Sanity-check the outputs and install_dirs
num_outdirs, num_out = len(outdirs), len(t.get_outputs())
if num_outdirs != 1 and num_outdirs != num_out:
- raise MesonException('Target {!r} has {} outputs, but only '
- '{} "install_dir"s were specified'
- ''.format(t.name, num_out, num_outdirs))
+ m = 'Target {!r} has {} outputs: {!r}, but only {} "install_dir"s were found.\n' \
+ "Pass 'false' for outputs that should not be installed and 'true' for\n" \
+ 'using the default installation directory for an output.'
+ raise MesonException(m.format(t.name, num_out, t.get_outputs(), num_outdirs))
# Install the target output(s)
if isinstance(t, build.BuildTarget):
+ should_strip = self.get_option_for_target('strip', t)
# Install primary build output (library/executable/jar, etc)
# Done separately because of strip/aliases/rpath
if outdirs[0] is not False:
