diff options
author | Simon Glass <sjg@chromium.org> | 2016-07-27 20:33:01 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-07-31 19:37:08 -0600 |
commit | 80e6a487505c44bffbf5bf97cfa5ce2176e0cd9b (patch) | |
tree | 6ca0101cb89cc83276c04d5496ab0fd186f088a0 /tools/buildman | |
parent | bd6f5d98de58723702f01a660a16269c54e2992e (diff) |
buildman: Allow the toolchain error to be suppressed
When there are no toolchains a warning is printed. But in some cases this is
confusing, such as when the user is fetching new toolchains.
Adjust the function to supress the warning in this case.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman')
-rw-r--r-- | tools/buildman/toolchain.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 3993db3a8d6..1e1ce42e8fe 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -167,15 +167,18 @@ class Toolchains: self.paths = [] self._make_flags = dict(bsettings.GetItems('make-flags')) - def GetPathList(self): + def GetPathList(self, show_warning=True): """Get a list of available toolchain paths + Args: + show_warning: True to show a warning if there are no tool chains. + Returns: List of strings, each a path to a toolchain mentioned in the [toolchain] section of the settings file. """ toolchains = bsettings.GetItems('toolchain') - if not toolchains: + if show_warning and not toolchains: print ('Warning: No tool chains - please add a [toolchain] section' ' to your buildman config file %s. See README for details' % bsettings.config_fname) @@ -188,9 +191,14 @@ class Toolchains: paths.append(value) return paths - def GetSettings(self): - self.prefixes = bsettings.GetItems('toolchain-prefix') - self.paths += self.GetPathList() + def GetSettings(self, show_warning=True): + """Get toolchain settings from the settings file. + + Args: + show_warning: True to show a warning if there are no tool chains. + """ + self.prefixes = bsettings.GetItems('toolchain-prefix') + self.paths += self.GetPathList(show_warning) def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC, arch=None): @@ -479,7 +487,7 @@ class Toolchains: Returns: True if the path is in settings, False if not """ - paths = self.GetPathList() + paths = self.GetPathList(False) return path in paths def ListArchs(self): |