summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-08-30 17:51:20 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-08-30 17:51:20 +0900
commit68b441956fda07c2d73d530f2e491a1948aa7eb8 (patch)
treed757d86cbaee7c67d05844bc05cc40b9d70d12ff
parent0e26667e7b8f4e3ba40c4b9364d57609b397b2a6 (diff)
downloadbuildstream-68b441956fda07c2d73d530f2e491a1948aa7eb8.tar.gz
source.py: Stylistic changes in Source.__do_fetch()
Added some comments to make the flow easier to follow, and removed an annoying 'success' variabled in favor of a for / else loop statement.
-rw-r--r--buildstream/source.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/buildstream/source.py b/buildstream/source.py
index 79d9e014f..7b28c3df8 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -517,10 +517,12 @@ class Source(Plugin):
def _fetch(self):
project = self._get_project()
source_fetchers = self.get_source_fetchers()
+
+ # Use the source fetchers if they are provided
+ #
if source_fetchers:
for fetcher in source_fetchers:
alias = fetcher._get_alias()
- success = False
for uri in project.get_alias_uris(alias, first_pass=self.__first_pass):
try:
fetcher.fetch(uri)
@@ -529,10 +531,16 @@ class Source(Plugin):
except BstError as e:
last_error = e
continue
- success = True
+
+ # No error, we're done with this fetcher
break
- if not success:
+
+ else:
+ # No break occurred, raise the last detected error
raise last_error
+
+ # Default codepath is to reinstantiate the Source
+ #
else:
alias = self._get_alias()
if self.__first_pass:
@@ -556,7 +564,11 @@ class Source(Plugin):
except BstError as e:
last_error = e
continue
+
+ # No error, we're done here
return
+
+ # Re raise the last detected error
raise last_error
# Wrapper for stage() api which gives the source