]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - tools/buildman/bsettings.py
buildman: Avoid looking at config file or toolchains in tests
[karo-tx-uboot.git] / tools / buildman / bsettings.py
index c80113056c8c248e593fae9610ec03bf5b337c78..fdd875b0736f9ec918c443b50778c84aef33cdfa 100644 (file)
@@ -5,6 +5,7 @@
 
 import ConfigParser
 import os
+import StringIO
 
 
 def Setup(fname=''):
@@ -17,11 +18,15 @@ def Setup(fname=''):
     global config_fname
 
     settings = ConfigParser.SafeConfigParser()
-    config_fname = fname
-    if config_fname == '':
-        config_fname = '%s/.buildman' % os.getenv('HOME')
-    if config_fname:
-        settings.read(config_fname)
+    if fname is not None:
+        config_fname = fname
+        if config_fname == '':
+            config_fname = '%s/.buildman' % os.getenv('HOME')
+        if config_fname:
+            settings.read(config_fname)
+
+def AddFile(data):
+    settings.readfp(StringIO.StringIO(data))
 
 def GetItems(section):
     """Get the items from a section of the config.
@@ -36,9 +41,6 @@ def GetItems(section):
         return settings.items(section)
     except ConfigParser.NoSectionError as e:
         print e
-        print ("Warning: No tool chains - please add a [toolchain] section "
-                "to your buildman config file %s. See README for details" %
-                config_fname)
         return []
     except:
         raise