aboutsummaryrefslogtreecommitdiff
path: root/tools/buildman/bsettings.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-10-31 07:42:53 -0600
committerSimon Glass <sjg@chromium.org>2019-11-04 18:15:32 -0700
commitc05aa0364280803d8274e260a739553d588ea052 (patch)
treef062c1f649d6ab5b6c1dab1c349efe81c9a4158a /tools/buildman/bsettings.py
parente3986d9b40f3e52217dea4c47f65e44e549c9ee2 (diff)
downloadu-boot-c05aa0364280803d8274e260a739553d588ea052.zip
u-boot-c05aa0364280803d8274e260a739553d588ea052.tar.gz
u-boot-c05aa0364280803d8274e260a739553d588ea052.tar.bz2
buildman: Convert to Python 3
Convert buildman to Python 3 and make it use that, to meet the 2020 deadline. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/bsettings.py')
-rw-r--r--tools/buildman/bsettings.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
index 03d7439..0b7208d 100644
--- a/tools/buildman/bsettings.py
+++ b/tools/buildman/bsettings.py
@@ -1,9 +1,9 @@
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2012 The Chromium OS Authors.
-import ConfigParser
+import configparser
import os
-import StringIO
+import io
def Setup(fname=''):
@@ -15,20 +15,20 @@ def Setup(fname=''):
global settings
global config_fname
- settings = ConfigParser.SafeConfigParser()
+ settings = configparser.SafeConfigParser()
if fname is not None:
config_fname = fname
if config_fname == '':
config_fname = '%s/.buildman' % os.getenv('HOME')
if not os.path.exists(config_fname):
- print 'No config file found ~/.buildman\nCreating one...\n'
+ print('No config file found ~/.buildman\nCreating one...\n')
CreateBuildmanConfigFile(config_fname)
- print 'To install tool chains, please use the --fetch-arch option'
+ print('To install tool chains, please use the --fetch-arch option')
if config_fname:
settings.read(config_fname)
def AddFile(data):
- settings.readfp(StringIO.StringIO(data))
+ settings.readfp(io.StringIO(data))
def GetItems(section):
"""Get the items from a section of the config.
@@ -41,7 +41,7 @@ def GetItems(section):
"""
try:
return settings.items(section)
- except ConfigParser.NoSectionError as e:
+ except configparser.NoSectionError as e:
return []
except:
raise
@@ -68,10 +68,10 @@ def CreateBuildmanConfigFile(config_fname):
try:
f = open(config_fname, 'w')
except IOError:
- print "Couldn't create buildman config file '%s'\n" % config_fname
+ print("Couldn't create buildman config file '%s'\n" % config_fname)
raise
- print >>f, '''[toolchain]
+ print('''[toolchain]
# name = path
# e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux
@@ -93,5 +93,5 @@ openrisc = or1k
# snapper-boards=ENABLE_AT91_TEST=1
# snapper9260=${snapper-boards} BUILD_TAG=442
# snapper9g45=${snapper-boards} BUILD_TAG=443
-'''
+''', file=f)
f.close();