From c97b385d5e30ee1eb4079b83a318049456d0b6f5 Mon Sep 17 00:00:00 2001 From: Tom Mewett Date: Tue, 10 Dec 2019 11:51:57 +0000 Subject: _gitsourcebase.py: Rename and refactor _ignore_submodule "Ignore submodule" sounds like it could be an action, so this changes the name to more clearly be a predicate. --- src/buildstream/_gitsourcebase.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/buildstream/_gitsourcebase.py b/src/buildstream/_gitsourcebase.py index 082c49177..5b7f051b9 100644 --- a/src/buildstream/_gitsourcebase.py +++ b/src/buildstream/_gitsourcebase.py @@ -606,7 +606,7 @@ class _GitSourceBase(Source): for submodule in self._recurse_submodules(configure=False): discovered_submodules[submodule.path] = submodule.url - if self._ignore_submodule(submodule.path): + if self._ignoring_submodule(submodule.path): continue if submodule.path not in self.submodule_overrides: @@ -697,7 +697,7 @@ class _GitSourceBase(Source): # def _configure_submodules(self, submodules): for submodule in submodules: - if self._ignore_submodule(submodule.path): + if self._ignoring_submodule(submodule.path): continue # Allow configuration to override the upstream location of the submodules. submodule.url = self.submodule_overrides.get(submodule.path, submodule.url) @@ -737,12 +737,13 @@ class _GitSourceBase(Source): tags.append((tag, commit_ref, annotated)) return tags - # Checks whether the plugin configuration has explicitly - # configured this submodule to be ignored - def _ignore_submodule(self, path): - try: - checkout = self.submodule_checkout_overrides[path] - except KeyError: - checkout = self.checkout_submodules - - return not checkout + # _ignoring_submodule(): + # + # Args: + # path (str): The path of a submodule in the superproject + # + # Returns: + # (bool): Whether to not clone/checkout this submodule + # + def _ignoring_submodule(self, path): + return not self.submodule_checkout_overrides.get(path, self.checkout_submodules) -- cgit v1.2.1