diff options
author | Tom Mewett <tom.mewett@codethink.co.uk> | 2019-12-10 11:51:57 +0000 |
---|---|---|
committer | Tom Mewett <tom.mewett@codethink.co.uk> | 2019-12-13 16:49:02 +0000 |
commit | c97b385d5e30ee1eb4079b83a318049456d0b6f5 (patch) | |
tree | 6587310a430b266cd4cda8e851ea2d1fb278f4a8 /src | |
parent | ffceb8bff785456895f4e3c6b6b1deb939373ed7 (diff) | |
download | buildstream-c97b385d5e30ee1eb4079b83a318049456d0b6f5.tar.gz |
_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.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_gitsourcebase.py | 23 |
1 files changed, 12 insertions, 11 deletions
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) |