diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 7aae1663fd1f..20703627b4dd 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -622,9 +622,15 @@ def _get_git(self, packagename: str) -> None: args += ['--branch', revno] args += [self.wrap.get('url'), self.directory] verbose_git(args, self.subdir_root, check=True) - if self.wrap.values.get('clone-recursive', '').lower() == 'true': - verbose_git(['submodule', 'update', '--init', '--checkout', '--recursive', *depth_option], - self.dirname, check=True) + + clone_recursive_val = self.wrap.values.get('clone-recursive') + if clone_recursive_val is not None: + clone_recursive_val = self.wrap.values.get('clone-recursive', '').lower() + if clone_recursive_val == 'true': + verbose_git(['submodule', 'update', '--init', '--checkout', '--recursive', *depth_option], + self.dirname, check=True) + elif clone_recursive_val != 'false': + raise WrapException('clone-recursive: invalid value (use \'true\' or \'false\')') push_url = self.wrap.values.get('push-url') if push_url: verbose_git(['remote', 'set-url', '--push', 'origin', push_url], self.dirname, check=True)