summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-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
9 files changed, 30 insertions, 28 deletions
diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py
index 23a2cae2b4..6917ec378a 100644
--- a/bitbake/lib/bb/COW.py
+++ b/bitbake/lib/bb/COW.py
@@ -82,7 +82,7 @@ class COWDictMeta(COWMeta):
82 print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__) 82 print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__)
83 try: 83 try:
84 value = value.copy() 84 value = value.copy()
85 except AttributeError, e: 85 except AttributeError as e:
86 value = copy.copy(value) 86 value = copy.copy(value)
87 setattr(cls, nkey, value) 87 setattr(cls, nkey, value)
88 return value 88 return value
@@ -106,7 +106,7 @@ class COWDictMeta(COWMeta):
106 raise AttributeError("key %s does not exist." % key) 106 raise AttributeError("key %s does not exist." % key)
107 107
108 return value 108 return value
109 except AttributeError, e: 109 except AttributeError as e:
110 if not default is cls.__getmarker__: 110 if not default is cls.__getmarker__:
111 return default 111 return default
112 112
@@ -239,7 +239,7 @@ if __name__ == "__main__":
239 239
240 try: 240 try:
241 b['dict2'] 241 b['dict2']
242 except KeyError, e: 242 except KeyError as e:
243 print("Okay!") 243 print("Okay!")
244 244
245 a['set'] = COWSetBase() 245 a['set'] = COWSetBase()
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 2b3dfb0cb4..6884e9a554 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -173,7 +173,7 @@ class BBCooker:
173 except bb.build.FuncFailed: 173 except bb.build.FuncFailed:
174 bb.msg.error(bb.msg.domain.Build, "task stack execution failed") 174 bb.msg.error(bb.msg.domain.Build, "task stack execution failed")
175 raise 175 raise
176 except bb.build.EventException, e: 176 except bb.build.EventException as e:
177 event = e.args[1] 177 event = e.args[1]
178 bb.msg.error(bb.msg.domain.Build, "%s event exception, aborting" % bb.event.getName(event)) 178 bb.msg.error(bb.msg.domain.Build, "%s event exception, aborting" % bb.event.getName(event))
179 raise 179 raise
@@ -259,10 +259,10 @@ class BBCooker:
259 if fn: 259 if fn:
260 try: 260 try:
261 envdata = self.bb_cache.loadDataFull(fn, self.configuration.data) 261 envdata = self.bb_cache.loadDataFull(fn, self.configuration.data)
262 except IOError, e: 262 except IOError as e:
263 bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e)) 263 bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e))
264 raise 264 raise
265 except Exception, e: 265 except Exception as e:
266 bb.msg.error(bb.msg.domain.Parsing, "%s" % e) 266 bb.msg.error(bb.msg.domain.Parsing, "%s" % e)
267 raise 267 raise
268 268
@@ -272,7 +272,7 @@ class BBCooker:
272 with closing(StringIO()) as env: 272 with closing(StringIO()) as env:
273 data.emit_env(env, envdata, True) 273 data.emit_env(env, envdata, True)
274 bb.msg.plain(env.getvalue()) 274 bb.msg.plain(env.getvalue())
275 except Exception, e: 275 except Exception as e:
276 bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e) 276 bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e)
277 277
278 # emit the metadata which isnt valid shell 278 # emit the metadata which isnt valid shell
@@ -499,7 +499,7 @@ class BBCooker:
499 """Drop off into a shell""" 499 """Drop off into a shell"""
500 try: 500 try:
501 from bb import shell 501 from bb import shell
502 except ImportError, details: 502 except ImportError as details:
503 bb.msg.fatal(bb.msg.domain.Parsing, "Sorry, shell not available (%s)" % details ) 503 bb.msg.fatal(bb.msg.domain.Parsing, "Sorry, shell not available (%s)" % details )
504 else: 504 else:
505 shell.start( self ) 505 shell.start( self )
@@ -569,9 +569,9 @@ class BBCooker:
569 bb.event.fire(bb.event.ConfigParsed(), self.configuration.data) 569 bb.event.fire(bb.event.ConfigParsed(), self.configuration.data)
570 570
571 571
572 except IOError, e: 572 except IOError as e:
573 bb.msg.fatal(bb.msg.domain.Parsing, "Error when parsing %s: %s" % (files, str(e))) 573 bb.msg.fatal(bb.msg.domain.Parsing, "Error when parsing %s: %s" % (files, str(e)))
574 except bb.parse.ParseError, details: 574 except bb.parse.ParseError as details:
575 bb.msg.fatal(bb.msg.domain.Parsing, "Unable to parse %s (%s)" % (files, details) ) 575 bb.msg.fatal(bb.msg.domain.Parsing, "Unable to parse %s (%s)" % (files, details) )
576 576
577 def handleCollections( self, collections ): 577 def handleCollections( self, collections ):
@@ -978,7 +978,7 @@ class CookerParser:
978 self.skipped += skipped 978 self.skipped += skipped
979 self.virtuals += virtuals 979 self.virtuals += virtuals
980 980
981 except IOError, e: 981 except IOError as e:
982 self.error += 1 982 self.error += 1
983 cooker.bb_cache.remove(f) 983 cooker.bb_cache.remove(f)
984 bb.msg.error(bb.msg.domain.Collection, "opening %s: %s" % (f, e)) 984 bb.msg.error(bb.msg.domain.Collection, "opening %s: %s" % (f, e))
@@ -987,7 +987,7 @@ class CookerParser:
987 cooker.bb_cache.remove(f) 987 cooker.bb_cache.remove(f)
988 cooker.bb_cache.sync() 988 cooker.bb_cache.sync()
989 raise 989 raise
990 except Exception, e: 990 except Exception as e:
991 self.error += 1 991 self.error += 1
992 cooker.bb_cache.remove(f) 992 cooker.bb_cache.remove(f)
993 bb.msg.error(bb.msg.domain.Collection, "%s while parsing %s" % (e, f)) 993 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 e87223ad6b..651fea8873 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):
409 stdout_handle = os.popen(cmd + " 2>&1", "r") 409 stdout_handle = os.popen(cmd + " 2>&1", "r")
410 output = "" 410 output = ""
411 411
412 while 1: 412 while True:
413 line = stdout_handle.readline() 413 line = stdout_handle.readline()
414 if not line: 414 if not line:
415 break 415 break
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 4eabe5f2a1..02d682d88f 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -23,7 +23,7 @@
23 23
24import bb, re, string 24import bb, re, string
25from bb import methodpool 25from bb import methodpool
26from itertools import chain 26import itertools
27 27
28__word__ = re.compile(r"\S+") 28__word__ = re.compile(r"\S+")
29__parsed_methods__ = bb.methodpool.get_parsed_dict() 29__parsed_methods__ = bb.methodpool.get_parsed_dict()
@@ -31,7 +31,8 @@ _bbversions_re = re.compile(r"\[(?P<from>[0-9]+)-(?P<to>[0-9]+)\]")
31 31
32class StatementGroup(list): 32class StatementGroup(list):
33 def eval(self, data): 33 def eval(self, data):
34 map(lambda x: x.eval(data), self) 34 for statement in self:
35 statement.eval(data)
35 36
36class AstNode(object): 37class AstNode(object):
37 pass 38 pass
@@ -341,7 +342,7 @@ def _expand_versions(versions):
341 versions = iter(versions) 342 versions = iter(versions)
342 while True: 343 while True:
343 try: 344 try:
344 version = versions.next() 345 version = next(versions)
345 except StopIteration: 346 except StopIteration:
346 break 347 break
347 348
@@ -351,7 +352,7 @@ def _expand_versions(versions):
351 else: 352 else:
352 newversions = expand_one(version, int(range_ver.group("from")), 353 newversions = expand_one(version, int(range_ver.group("from")),
353 int(range_ver.group("to"))) 354 int(range_ver.group("to")))
354 versions = chain(newversions, versions) 355 versions = itertools.chain(newversions, versions)
355 356
356def multi_finalize(fn, d): 357def multi_finalize(fn, d):
357 safe_d = d 358 safe_d = d
@@ -417,7 +418,7 @@ def multi_finalize(fn, d):
417 safe_d.setVar("BBCLASSEXTEND", extended) 418 safe_d.setVar("BBCLASSEXTEND", extended)
418 _create_variants(datastores, extended.split(), extendfunc) 419 _create_variants(datastores, extended.split(), extendfunc)
419 420
420 for variant, variant_d in datastores.items(): 421 for variant, variant_d in datastores.iteritems():
421 if variant: 422 if variant:
422 try: 423 try:
423 finalize(fn, variant_d) 424 finalize(fn, variant_d)
@@ -425,7 +426,7 @@ def multi_finalize(fn, d):
425 bb.data.setVar("__SKIPPED", True, variant_d) 426 bb.data.setVar("__SKIPPED", True, variant_d)
426 427
427 if len(datastores) > 1: 428 if len(datastores) > 1:
428 variants = filter(None, datastores.keys()) 429 variants = filter(None, datastores.iterkeys())
429 safe_d.setVar("__VARIANTS", " ".join(variants)) 430 safe_d.setVar("__VARIANTS", " ".join(variants))
430 431
431 datastores[""] = d 432 datastores[""] = d
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 93fff5d27b..a4aea6c004 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -928,7 +928,7 @@ class RunQueue:
928 while True: 928 while True:
929 task = None 929 task = None
930 if self.stats.active < self.number_tasks: 930 if self.stats.active < self.number_tasks:
931 task = self.sched.next() 931 task = next(self.sched)
932 if task is not None: 932 if task is not None:
933 fn = self.taskData.fn_index[self.runq_fnid[task]] 933 fn = self.taskData.fn_index[self.runq_fnid[task]]
934 934
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py
index aeead679b2..f9ca9d5bd3 100644
--- a/bitbake/lib/bb/shell.py
+++ b/bitbake/lib/bb/shell.py
@@ -53,6 +53,7 @@ PROBLEMS:
53########################################################################## 53##########################################################################
54 54
55from __future__ import print_function 55from __future__ import print_function
56from functools import reduce
56try: 57try:
57 set 58 set
58except NameError: 59except NameError:
@@ -178,12 +179,12 @@ class BitBakeShellCommands:
178 print("ERROR: No Provider") 179 print("ERROR: No Provider")
179 last_exception = Providers.NoProvider 180 last_exception = Providers.NoProvider
180 181
181 except runqueue.TaskFailure, fnids: 182 except runqueue.TaskFailure as fnids:
182 for fnid in fnids: 183 for fnid in fnids:
183 print("ERROR: '%s' failed" % td.fn_index[fnid]) 184 print("ERROR: '%s' failed" % td.fn_index[fnid])
184 last_exception = runqueue.TaskFailure 185 last_exception = runqueue.TaskFailure
185 186
186 except build.EventException, e: 187 except build.EventException as e:
187 print("ERROR: Couldn't build '%s'" % names) 188 print("ERROR: Couldn't build '%s'" % names)
188 last_exception = e 189 last_exception = e
189 190
@@ -246,7 +247,7 @@ class BitBakeShellCommands:
246 cooker.buildFile(bf, cmd) 247 cooker.buildFile(bf, cmd)
247 except parse.ParseError: 248 except parse.ParseError:
248 print("ERROR: Unable to open or parse '%s'" % bf) 249 print("ERROR: Unable to open or parse '%s'" % bf)
249 except build.EventException, e: 250 except build.EventException as e:
250 print("ERROR: Couldn't build '%s'" % name) 251 print("ERROR: Couldn't build '%s'" % name)
251 last_exception = e 252 last_exception = e
252 253
@@ -644,7 +645,7 @@ def columnize( alist, width = 80 ):
644 return reduce(lambda line, word, width=width: '%s%s%s' % 645 return reduce(lambda line, word, width=width: '%s%s%s' %
645 (line, 646 (line,
646 ' \n'[(len(line[line.rfind('\n')+1:]) 647 ' \n'[(len(line[line.rfind('\n')+1:])
647 + len(word.split('\n',1)[0] 648 + len(word.split('\n', 1)[0]
648 ) >= width)], 649 ) >= width)],
649 word), 650 word),
650 alist 651 alist
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index bfdcc5b495..f81759abf8 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -123,7 +123,7 @@ def init(server, eventHandler):
123 x = event.sofar 123 x = event.sofar
124 y = event.total 124 y = event.total
125 if os.isatty(sys.stdout.fileno()): 125 if os.isatty(sys.stdout.fileno()):
126 sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100//y ) ) 126 sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) )
127 sys.stdout.flush() 127 sys.stdout.flush()
128 else: 128 else:
129 if x == 1: 129 if x == 1:
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py
index e3bca2af83..81dcb1998c 100644
--- a/bitbake/lib/bb/ui/ncurses.py
+++ b/bitbake/lib/bb/ui/ncurses.py
@@ -266,7 +266,7 @@ class NCursesUI:
266 mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked." 266 mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked."
267 % ( event.cached, event.parsed, event.skipped, event.masked )) 267 % ( event.cached, event.parsed, event.skipped, event.masked ))
268 else: 268 else:
269 mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) ) 269 mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100/y ) )
270# if isinstance(event, bb.build.TaskFailed): 270# if isinstance(event, bb.build.TaskFailed):
271# if event.logfile: 271# if event.logfile:
272# if data.getVar("BBINCLUDELOGS", d): 272# if data.getVar("BBINCLUDELOGS", d):
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index a7fb44d7d2..c0cc9c6ea2 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -326,7 +326,7 @@ def better_exec(code, context, text, realfile):
326 """ 326 """
327 import bb.parse 327 import bb.parse
328 try: 328 try:
329 exec code in _context, context 329 exec(code, _context, context)
330 except: 330 except:
331 (t, value, tb) = sys.exc_info() 331 (t, value, tb) = sys.exc_info()
332 332
@@ -349,7 +349,7 @@ def better_exec(code, context, text, realfile):
349 raise 349 raise
350 350
351def simple_exec(code, context): 351def simple_exec(code, context):
352 exec code in _context, context 352 exec(code, _context, context)
353 353
354def better_eval(source, locals): 354def better_eval(source, locals):
355 return eval(source, _context, locals) 355 return eval(source, _context, locals)