All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 04/11] buildman: Allow the toolchain error to be suppressed
Date: Wed, 27 Jul 2016 20:33:01 -0600	[thread overview]
Message-ID: <1469673188-15834-5-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1469673188-15834-1-git-send-email-sjg@chromium.org>

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>
---

Changes in v2:
- Add code to actually suppress the warning

 tools/buildman/toolchain.py | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
index 3993db3..1e1ce42 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):
-- 
2.8.0.rc3.226.g39d4020

  parent reply	other threads:[~2016-07-28  2:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28  2:32 [U-Boot] [PATCH v2 00/11] buildman: Make the tool friendlier for first-time users Simon Glass
2016-07-28  2:32 ` [U-Boot] [PATCH v2 01/11] buildman: Tidy up the README a little Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:32 ` [U-Boot] [PATCH v2 02/11] buildman: Automatically create a config file if needed Simon Glass
2016-07-28  3:28   ` Tom Rini
2016-08-01 18:22     ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 03/11] buildman: Fix the 'help' test to use the correct path Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:33 ` Simon Glass [this message]
2016-08-01 18:22   ` [U-Boot] [PATCH v2 04/11] buildman: Allow the toolchain error to be suppressed Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 05/11] buildman: Improve the toolchain progress/error output Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 06/11] buildman: Fix a typo in TestSettingsHasPath() Simon Glass
2016-07-28  3:28   ` Tom Rini
2016-08-01 18:22     ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 07/11] buildman: Drop the toolchain error when downloading toolchains Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 08/11] buildman: Avoid overwriting existing toolchain entries Simon Glass
2016-07-28  3:28   ` Tom Rini
2016-08-01 18:22     ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 09/11] buildman: Add a quick-start note Simon Glass
2016-07-28  3:28   ` Tom Rini
2016-08-01 18:22     ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 10/11] Drop the MAKEALL tool Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 11/11] Drop references to MAKEALL in the documentation Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  3:28 ` [U-Boot] [PATCH v2 00/11] buildman: Make the tool friendlier for first-time users Tom Rini
2016-07-28  3:32   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469673188-15834-5-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.