summaryrefslogtreecommitdiff
path: root/tools/buildman/bsettings.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-09-05 19:00:15 -0600
committerSimon Glass <sjg@chromium.org>2014-09-09 16:38:28 -0600
commit8b985eebd0f7582614399fdf6c108a81ab446ae7 (patch)
tree1001d27306e586a65b75adc7fc30aa2d07c3a092 /tools/buildman/bsettings.py
parentfd03d63f347e28e4e4394245210f048c82c9b085 (diff)
downloadu-boot-imx-8b985eebd0f7582614399fdf6c108a81ab446ae7.zip
u-boot-imx-8b985eebd0f7582614399fdf6c108a81ab446ae7.tar.gz
u-boot-imx-8b985eebd0f7582614399fdf6c108a81ab446ae7.tar.bz2
buildman: Avoid looking at config file or toolchains in tests
These files may not exist in the environment, or may not be suitable for testing. Provide our own config file and our own toolchains when running tests. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/bsettings.py')
-rw-r--r--tools/buildman/bsettings.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
index 9164798..fdd875b 100644
--- a/tools/buildman/bsettings.py
+++ b/tools/buildman/bsettings.py
@@ -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.