summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/bin/bitbake2
-rwxr-xr-xbitbake/bin/bitdoc26
-rw-r--r--bitbake/lib/bb/COW.py6
-rw-r--r--bitbake/lib/bb/cooker.py18
-rw-r--r--bitbake/lib/bb/fetch/__init__.py2
-rw-r--r--bitbake/lib/bb/parse/ast.py13
-rw-r--r--bitbake/lib/bb/runqueue.py2
-rw-r--r--bitbake/lib/bb/shell.py9
-rw-r--r--bitbake/lib/bb/ui/knotty.py2
-rw-r--r--bitbake/lib/bb/ui/ncurses.py2
-rw-r--r--bitbake/lib/bb/utils.py4
11 files changed, 43 insertions, 43 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 34cfadb98..fdf1e20f8 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -200,7 +200,7 @@ Default BBFILES are the .bb files in the current directory.""")
else:
try:
return_value = ui_init(serverConnection.connection, serverConnection.events)
- except Exception, e:
+ except Exception as e:
print "FATAL: Unable to start to '%s' UI: %s" % (ui, e)
raise
finally:
diff --git a/bitbake/bin/bitdoc b/bitbake/bin/bitdoc
index 4940f660a..8043b2bd1 100755
--- a/bitbake/bin/bitdoc
+++ b/bitbake/bin/bitdoc
@@ -48,7 +48,7 @@ class HTMLFormatter:
From pydoc... almost identical at least
"""
while pairs:
- (a,b) = pairs[0]
+ (a, b) = pairs[0]
text = join(split(text, a), b)
pairs = pairs[1:]
return text
@@ -87,7 +87,7 @@ class HTMLFormatter:
return txt + ",".join(txts)
- def groups(self,item):
+ def groups(self, item):
"""
Create HTML to link to related groups
"""
@@ -99,12 +99,12 @@ class HTMLFormatter:
txt = "<p><b>See also:</b><br>"
txts = []
for group in item.groups():
- txts.append( """<a href="group%s.html">%s</a> """ % (group,group) )
+ txts.append( """<a href="group%s.html">%s</a> """ % (group, group) )
return txt + ",".join(txts)
- def createKeySite(self,item):
+ def createKeySite(self, item):
"""
Create a site for a key. It contains the header/navigator, a heading,
the description, links to related keys and to the groups.
@@ -149,8 +149,7 @@ class HTMLFormatter:
"""
groups = ""
- sorted_groups = doc.groups()
- sorted_groups.sort()
+ sorted_groups = sorted(doc.groups())
for group in sorted_groups:
groups += """<a href="group%s.html">%s</a><br>""" % (group, group)
@@ -185,8 +184,7 @@ class HTMLFormatter:
Create Overview of all avilable keys
"""
keys = ""
- sorted_keys = doc.doc_keys()
- sorted_keys.sort()
+ sorted_keys = sorted(doc.doc_keys())
for key in sorted_keys:
keys += """<a href="key%s.html">%s</a><br>""" % (key, key)
@@ -214,7 +212,7 @@ class HTMLFormatter:
description += "<h2 Description of Grozp %s</h2>" % gr
description += _description
- items.sort(lambda x,y:cmp(x.name(),y.name()))
+ items.sort(lambda x, y:cmp(x.name(), y.name()))
for group in items:
groups += """<a href="key%s.html">%s</a><br>""" % (group.name(), group.name())
@@ -343,7 +341,7 @@ class DocumentationItem:
def addGroup(self, group):
self._groups.append(group)
- def addRelation(self,relation):
+ def addRelation(self, relation):
self._related.append(relation)
def sort(self):
@@ -396,7 +394,7 @@ class Documentation:
"""
return self.__groups.keys()
- def group_content(self,group_name):
+ def group_content(self, group_name):
"""
Return a list of keys/names that are in a specefic
group or the empty list
@@ -412,7 +410,7 @@ def parse_cmdline(args):
Parse the CMD line and return the result as a n-tuple
"""
- parser = optparse.OptionParser( version = "Bitbake Documentation Tool Core version %s, %%prog version %s" % (bb.__version__,__version__))
+ parser = optparse.OptionParser( version = "Bitbake Documentation Tool Core version %s, %%prog version %s" % (bb.__version__, __version__))
usage = """%prog [options]
Create a set of html pages (documentation) for a bitbake.conf....
@@ -428,7 +426,7 @@ Create a set of html pages (documentation) for a bitbake.conf....
parser.add_option( "-D", "--debug", help = "Increase the debug level",
action = "count", dest = "debug", default = 0 )
- parser.add_option( "-v","--verbose", help = "output more chit-char to the terminal",
+ parser.add_option( "-v", "--verbose", help = "output more chit-char to the terminal",
action = "store_true", dest = "verbose", default = False )
options, args = parser.parse_args( sys.argv )
@@ -443,7 +441,7 @@ def main():
The main Method
"""
- (config_file,output_dir) = parse_cmdline( sys.argv )
+ (config_file, output_dir) = parse_cmdline( sys.argv )
# right to let us load the file now
try:
diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py
index 23a2cae2b..6917ec378 100644
--- a/bitbake/lib/bb/COW.py
+++ b/bitbake/lib/bb/COW.py
@@ -82,7 +82,7 @@ class COWDictMeta(COWMeta):
print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__)
try:
value = value.copy()
- except AttributeError, e:
+ except AttributeError as e:
value = copy.copy(value)
setattr(cls, nkey, value)
return value
@@ -106,7 +106,7 @@ class COWDictMeta(COWMeta):
raise AttributeError("key %s does not exist." % key)
return value
- except AttributeError, e:
+ except AttributeError as e:
if not default is cls.__getmarker__:
return default
@@ -239,7 +239,7 @@ if __name__ == "__main__":
try:
b['dict2']
- except KeyError, e:
+ except KeyError as e:
print("Okay!")
a['set'] = COWSetBase()
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 2b3dfb0cb..6884e9a55 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -173,7 +173,7 @@ class BBCooker:
except bb.build.FuncFailed:
bb.msg.error(bb.msg.domain.Build, "task stack execution failed")
raise
- except bb.build.EventException, e:
+ except bb.build.EventException as e:
event = e.args[1]
bb.msg.error(bb.msg.domain.Build, "%s event exception, aborting" % bb.event.getName(event))
raise
@@ -259,10 +259,10 @@ class BBCooker:
if fn:
try:
envdata = self.bb_cache.loadDataFull(fn, self.configuration.data)
- except IOError, e:
+ except IOError as e:
bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e))
raise
- except Exception, e:
+ except Exception as e:
bb.msg.error(bb.msg.domain.Parsing, "%s" % e)
raise
@@ -272,7 +272,7 @@ class BBCooker:
with closing(StringIO()) as env:
data.emit_env(env, envdata, True)
bb.msg.plain(env.getvalue())
- except Exception, e:
+ except Exception as e:
bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e)
# emit the metadata which isnt valid shell
@@ -499,7 +499,7 @@ class BBCooker:
"""Drop off into a shell"""
try:
from bb import shell
- except ImportError, details:
+ except ImportError as details:
bb.msg.fatal(bb.msg.domain.Parsing, "Sorry, shell not available (%s)" % details )
else:
shell.start( self )
@@ -569,9 +569,9 @@ class BBCooker:
bb.event.fire(bb.event.ConfigParsed(), self.configuration.data)
- except IOError, e:
+ except IOError as e:
bb.msg.fatal(bb.msg.domain.Parsing, "Error when parsing %s: %s" % (files, str(e)))
- except bb.parse.ParseError, details:
+ except bb.parse.ParseError as details:
bb.msg.fatal(bb.msg.domain.Parsing, "Unable to parse %s (%s)" % (files, details) )
def handleCollections( self, collections ):
@@ -978,7 +978,7 @@ class CookerParser:
self.skipped += skipped
self.virtuals += virtuals
- except IOError, e:
+ except IOError as e:
self.error += 1
cooker.bb_cache.remove(f)
bb.msg.error(bb.msg.domain.Collection, "opening %s: %s" % (f, e))
@@ -987,7 +987,7 @@ class CookerParser:
cooker.bb_cache.remove(f)
cooker.bb_cache.sync()
raise
- except Exception, e:
+ except Exception as e:
self.error += 1
cooker.bb_cache.remove(f)
bb.msg.error(bb.msg.domain.Collection, "%s while parsing %s" % (e, f))
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index e87223ad6..651fea887 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -409,7 +409,7 @@ def runfetchcmd(cmd, d, quiet = False):
stdout_handle = os.popen(cmd + " 2>&1", "r")
output = ""
- while 1:
+ while True:
line = stdout_handle.readline()
if not line:
break
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 4eabe5f2a..02d682d88 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -23,7 +23,7 @@
import bb, re, string
from bb import methodpool
-from itertools import chain
+import itertools
__word__ = re.compile(r"\S+")
__parsed_methods__ = bb.methodpool.get_parsed_dict()
@@ -31,7 +31,8 @@ _bbversions_re = re.compile(r"\[(?P<from>[0-9]+)-(?P<to>[0-9]+)\]")
class StatementGroup(list):
def eval(self, data):
- map(lambda x: x.eval(data), self)
+ for statement in self:
+ statement.eval(data)
class AstNode(object):
pass
@@ -341,7 +342,7 @@ def _expand_versions(versions):
versions = iter(versions)
while True:
try:
- version = versions.next()
+ version = next(versions)
except StopIteration:
break
@@ -351,7 +352,7 @@ def _expand_versions(versions):
else:
newversions = expand_one(version, int(range_ver.group("from")),
int(range_ver.group("to")))
- versions = chain(newversions, versions)
+ versions = itertools.chain(newversions, versions)
def multi_finalize(fn, d):
safe_d = d
@@ -417,7 +418,7 @@ def multi_finalize(fn, d):
safe_d.setVar("BBCLASSEXTEND", extended)
_create_variants(datastores, extended.split(), extendfunc)
- for variant, variant_d in datastores.items():
+ for variant, variant_d in datastores.iteritems():
if variant:
try:
finalize(fn, variant_d)
@@ -425,7 +426,7 @@ def multi_finalize(fn, d):
bb.data.setVar("__SKIPPED", True, variant_d)
if len(datastores) > 1:
- variants = filter(None, datastores.keys())
+ variants = filter(None, datastores.iterkeys())
safe_d.setVar("__VARIANTS", " ".join(variants))
datastores[""] = d
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 93fff5d27..a4aea6c00 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -928,7 +928,7 @@ class RunQueue:
while True:
task = None
if self.stats.active < self.number_tasks:
- task = self.sched.next()
+ task = next(self.sched)
if task is not None:
fn = self.taskData.fn_index[self.runq_fnid[task]]
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py
index aeead679b..f9ca9d5bd 100644
--- a/bitbake/lib/bb/shell.py
+++ b/bitbake/lib/bb/shell.py
@@ -53,6 +53,7 @@ PROBLEMS:
##########################################################################
from __future__ import print_function
+from functools import reduce
try:
set
except NameError:
@@ -178,12 +179,12 @@ class BitBakeShellCommands:
print("ERROR: No Provider")
last_exception = Providers.NoProvider
- except runqueue.TaskFailure, fnids:
+ except runqueue.TaskFailure as fnids:
for fnid in fnids:
print("ERROR: '%s' failed" % td.fn_index[fnid])
last_exception = runqueue.TaskFailure
- except build.EventException, e:
+ except build.EventException as e:
print("ERROR: Couldn't build '%s'" % names)
last_exception = e
@@ -246,7 +247,7 @@ class BitBakeShellCommands:
cooker.buildFile(bf, cmd)
except parse.ParseError:
print("ERROR: Unable to open or parse '%s'" % bf)
- except build.EventException, e:
+ except build.EventException as e:
print("ERROR: Couldn't build '%s'" % name)
last_exception = e
@@ -644,7 +645,7 @@ def columnize( alist, width = 80 ):
return reduce(lambda line, word, width=width: '%s%s%s' %
(line,
' \n'[(len(line[line.rfind('\n')+1:])
- + len(word.split('\n',1)[0]
+ + len(word.split('\n', 1)[0]
) >= width)],
word),
alist
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index bfdcc5b49..f81759abf 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -123,7 +123,7 @@ def init(server, eventHandler):
x = event.sofar
y = event.total
if os.isatty(sys.stdout.fileno()):
- sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100//y ) )
+ sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) )
sys.stdout.flush()
else:
if x == 1:
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py
index e3bca2af8..81dcb1998 100644
--- a/bitbake/lib/bb/ui/ncurses.py
+++ b/bitbake/lib/bb/ui/ncurses.py
@@ -266,7 +266,7 @@ class NCursesUI:
mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked."
% ( event.cached, event.parsed, event.skipped, event.masked ))
else:
- mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) )
+ mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100/y ) )
# if isinstance(event, bb.build.TaskFailed):
# if event.logfile:
# if data.getVar("BBINCLUDELOGS", d):
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index a7fb44d7d..c0cc9c6ea 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -326,7 +326,7 @@ def better_exec(code, context, text, realfile):
"""
import bb.parse
try:
- exec code in _context, context
+ exec(code, _context, context)
except:
(t, value, tb) = sys.exc_info()
@@ -349,7 +349,7 @@ def better_exec(code, context, text, realfile):
raise
def simple_exec(code, context):
- exec code in _context, context
+ exec(code, _context, context)
def better_eval(source, locals):
return eval(source, _context, locals)