summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/COW.py119
-rw-r--r--bitbake/lib/bb/cooker.py33
-rw-r--r--bitbake/lib/bb/event.py4
-rw-r--r--bitbake/lib/bb/fetch/__init__.py2
-rw-r--r--bitbake/lib/bb/fetch/git.py2
-rw-r--r--bitbake/lib/bb/fetch/ssh.py2
-rw-r--r--bitbake/lib/bb/msg.py12
-rw-r--r--bitbake/lib/bb/runqueue.py4
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py4
-rw-r--r--bitbake/lib/bb/shell.py146
-rw-r--r--bitbake/lib/bb/ui/crumbs/buildmanager.py4
-rw-r--r--bitbake/lib/bb/ui/depexp.py18
-rw-r--r--bitbake/lib/bb/ui/goggle.py6
-rw-r--r--bitbake/lib/bb/ui/knotty.py44
-rw-r--r--bitbake/lib/bb/ui/ncurses.py6
-rw-r--r--bitbake/lib/bb/ui/puccho.py10
-rw-r--r--bitbake/lib/bb/utils.py22
17 files changed, 220 insertions, 218 deletions
diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py
index 224213db5c..b0afb5fa08 100644
--- a/bitbake/lib/bb/COW.py
+++ b/bitbake/lib/bb/COW.py
@@ -23,6 +23,7 @@
23# Assign a file to __warn__ to get warnings about slow operations. 23# Assign a file to __warn__ to get warnings about slow operations.
24# 24#
25 25
26from __future__ import print_function
26import copy 27import copy
27import types 28import types
28types.ImmutableTypes = tuple([ \ 29types.ImmutableTypes = tuple([ \
@@ -77,7 +78,7 @@ class COWDictMeta(COWMeta):
77 return value 78 return value
78 79
79 if not cls.__warn__ is False and not isinstance(value, COWMeta): 80 if not cls.__warn__ is False and not isinstance(value, COWMeta):
80 print >> cls.__warn__, "Warning: Doing a copy because %s is a mutable type." % key 81 print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__)
81 try: 82 try:
82 value = value.copy() 83 value = value.copy()
83 except AttributeError, e: 84 except AttributeError, e:
@@ -153,11 +154,11 @@ class COWDictMeta(COWMeta):
153 return cls.iter("keys") 154 return cls.iter("keys")
154 def itervalues(cls, readonly=False): 155 def itervalues(cls, readonly=False):
155 if not cls.__warn__ is False and cls.__hasmutable__ and readonly is False: 156 if not cls.__warn__ is False and cls.__hasmutable__ and readonly is False:
156 print >> cls.__warn__, "Warning: If you arn't going to change any of the values call with True." 157 print("Warning: If you arn't going to change any of the values call with True.", file=cls.__warn__)
157 return cls.iter("values", readonly) 158 return cls.iter("values", readonly)
158 def iteritems(cls, readonly=False): 159 def iteritems(cls, readonly=False):
159 if not cls.__warn__ is False and cls.__hasmutable__ and readonly is False: 160 if not cls.__warn__ is False and cls.__hasmutable__ and readonly is False:
160 print >> cls.__warn__, "Warning: If you arn't going to change any of the values call with True." 161 print("Warning: If you arn't going to change any of the values call with True.", file=cls.__warn__)
161 return cls.iter("items", readonly) 162 return cls.iter("items", readonly)
162 163
163class COWSetMeta(COWDictMeta): 164class COWSetMeta(COWDictMeta):
@@ -199,120 +200,120 @@ if __name__ == "__main__":
199 import sys 200 import sys
200 COWDictBase.__warn__ = sys.stderr 201 COWDictBase.__warn__ = sys.stderr
201 a = COWDictBase() 202 a = COWDictBase()
202 print "a", a 203 print("a", a)
203 204
204 a['a'] = 'a' 205 a['a'] = 'a'
205 a['b'] = 'b' 206 a['b'] = 'b'
206 a['dict'] = {} 207 a['dict'] = {}
207 208
208 b = a.copy() 209 b = a.copy()
209 print "b", b 210 print("b", b)
210 b['c'] = 'b' 211 b['c'] = 'b'
211 212
212 print 213 print()
213 214
214 print "a", a 215 print("a", a)
215 for x in a.iteritems(): 216 for x in a.iteritems():
216 print x 217 print(x)
217 print "--" 218 print("--")
218 print "b", b 219 print("b", b)
219 for x in b.iteritems(): 220 for x in b.iteritems():
220 print x 221 print(x)
221 print 222 print()
222 223
223 b['dict']['a'] = 'b' 224 b['dict']['a'] = 'b'
224 b['a'] = 'c' 225 b['a'] = 'c'
225 226
226 print "a", a 227 print("a", a)
227 for x in a.iteritems(): 228 for x in a.iteritems():
228 print x 229 print(x)
229 print "--" 230 print("--")
230 print "b", b 231 print("b", b)
231 for x in b.iteritems(): 232 for x in b.iteritems():
232 print x 233 print(x)
233 print 234 print()
234 235
235 try: 236 try:
236 b['dict2'] 237 b['dict2']
237 except KeyError, e: 238 except KeyError, e:
238 print "Okay!" 239 print("Okay!")
239 240
240 a['set'] = COWSetBase() 241 a['set'] = COWSetBase()
241 a['set'].add("o1") 242 a['set'].add("o1")
242 a['set'].add("o1") 243 a['set'].add("o1")
243 a['set'].add("o2") 244 a['set'].add("o2")
244 245
245 print "a", a 246 print("a", a)
246 for x in a['set'].itervalues(): 247 for x in a['set'].itervalues():
247 print x 248 print(x)
248 print "--" 249 print("--")
249 print "b", b 250 print("b", b)
250 for x in b['set'].itervalues(): 251 for x in b['set'].itervalues():
251 print x 252 print(x)
252 print 253 print()
253 254
254 b['set'].add('o3') 255 b['set'].add('o3')
255 256
256 print "a", a 257 print("a", a)
257 for x in a['set'].itervalues(): 258 for x in a['set'].itervalues():
258 print x 259 print(x)
259 print "--" 260 print("--")
260 print "b", b 261 print("b", b)
261 for x in b['set'].itervalues(): 262 for x in b['set'].itervalues():
262 print x 263 print(x)
263 print 264 print()
264 265
265 a['set2'] = set() 266 a['set2'] = set()
266 a['set2'].add("o1") 267 a['set2'].add("o1")
267 a['set2'].add("o1") 268 a['set2'].add("o1")
268 a['set2'].add("o2") 269 a['set2'].add("o2")
269 270
270 print "a", a 271 print("a", a)
271 for x in a.iteritems(): 272 for x in a.iteritems():
272 print x 273 print(x)
273 print "--" 274 print("--")
274 print "b", b 275 print("b", b)
275 for x in b.iteritems(readonly=True): 276 for x in b.iteritems(readonly=True):
276 print x 277 print(x)
277 print 278 print()
278 279
279 del b['b'] 280 del b['b']
280 try: 281 try:
281 print b['b'] 282 print(b['b'])
282 except KeyError: 283 except KeyError:
283 print "Yay! deleted key raises error" 284 print("Yay! deleted key raises error")
284 285
285 if b.has_key('b'): 286 if b.has_key('b'):
286 print "Boo!" 287 print("Boo!")
287 else: 288 else:
288 print "Yay - has_key with delete works!" 289 print("Yay - has_key with delete works!")
289 290
290 print "a", a 291 print("a", a)
291 for x in a.iteritems(): 292 for x in a.iteritems():
292 print x 293 print(x)
293 print "--" 294 print("--")
294 print "b", b 295 print("b", b)
295 for x in b.iteritems(readonly=True): 296 for x in b.iteritems(readonly=True):
296 print x 297 print(x)
297 print 298 print()
298 299
299 b.__revertitem__('b') 300 b.__revertitem__('b')
300 301
301 print "a", a 302 print("a", a)
302 for x in a.iteritems(): 303 for x in a.iteritems():
303 print x 304 print(x)
304 print "--" 305 print("--")
305 print "b", b 306 print("b", b)
306 for x in b.iteritems(readonly=True): 307 for x in b.iteritems(readonly=True):
307 print x 308 print(x)
308 print 309 print()
309 310
310 b.__revertitem__('dict') 311 b.__revertitem__('dict')
311 print "a", a 312 print("a", a)
312 for x in a.iteritems(): 313 for x in a.iteritems():
313 print x 314 print(x)
314 print "--" 315 print("--")
315 print "b", b 316 print("b", b)
316 for x in b.iteritems(readonly=True): 317 for x in b.iteritems(readonly=True):
317 print x 318 print(x)
318 print 319 print()
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 6090efcad9..eaee797cb5 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -22,6 +22,7 @@
22# with this program; if not, write to the Free Software Foundation, Inc., 22# with this program; if not, write to the Free Software Foundation, Inc.,
23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 24
25from __future__ import print_function
25import sys, os, glob, os.path, re, time 26import sys, os, glob, os.path, re, time
26import bb 27import bb
27from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue 28from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue
@@ -396,51 +397,51 @@ class BBCooker:
396 397
397 # Prints a flattened form of package-depends below where subpackages of a package are merged into the main pn 398 # Prints a flattened form of package-depends below where subpackages of a package are merged into the main pn
398 depends_file = file('pn-depends.dot', 'w' ) 399 depends_file = file('pn-depends.dot', 'w' )
399 print >> depends_file, "digraph depends {" 400 print("digraph depends {", file=depends_file)
400 for pn in depgraph["pn"]: 401 for pn in depgraph["pn"]:
401 fn = depgraph["pn"][pn]["filename"] 402 fn = depgraph["pn"][pn]["filename"]
402 version = depgraph["pn"][pn]["version"] 403 version = depgraph["pn"][pn]["version"]
403 print >> depends_file, '"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn) 404 print('"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn), file=depends_file)
404 for pn in depgraph["depends"]: 405 for pn in depgraph["depends"]:
405 for depend in depgraph["depends"][pn]: 406 for depend in depgraph["depends"][pn]:
406 print >> depends_file, '"%s" -> "%s"' % (pn, depend) 407 print('"%s" -> "%s"' % (pn, depend), file=depends_file)
407 for pn in depgraph["rdepends-pn"]: 408 for pn in depgraph["rdepends-pn"]:
408 for rdepend in depgraph["rdepends-pn"][pn]: 409 for rdepend in depgraph["rdepends-pn"][pn]:
409 print >> depends_file, '"%s" -> "%s" [style=dashed]' % (pn, rdepend) 410 print('"%s" -> "%s" [style=dashed]' % (pn, rdepend), file=depends_file)
410 print >> depends_file, "}" 411 print("}", file=depends_file)
411 bb.msg.plain("PN dependencies saved to 'pn-depends.dot'") 412 bb.msg.plain("PN dependencies saved to 'pn-depends.dot'")
412 413
413 depends_file = file('package-depends.dot', 'w' ) 414 depends_file = file('package-depends.dot', 'w' )
414 print >> depends_file, "digraph depends {" 415 print("digraph depends {", file=depends_file)
415 for package in depgraph["packages"]: 416 for package in depgraph["packages"]:
416 pn = depgraph["packages"][package]["pn"] 417 pn = depgraph["packages"][package]["pn"]
417 fn = depgraph["packages"][package]["filename"] 418 fn = depgraph["packages"][package]["filename"]
418 version = depgraph["packages"][package]["version"] 419 version = depgraph["packages"][package]["version"]
419 if package == pn: 420 if package == pn:
420 print >> depends_file, '"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn) 421 print('"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn), file=depends_file)
421 else: 422 else:
422 print >> depends_file, '"%s" [label="%s(%s) %s\\n%s"]' % (package, package, pn, version, fn) 423 print('"%s" [label="%s(%s) %s\\n%s"]' % (package, package, pn, version, fn), file=depends_file)
423 for depend in depgraph["depends"][pn]: 424 for depend in depgraph["depends"][pn]:
424 print >> depends_file, '"%s" -> "%s"' % (package, depend) 425 print('"%s" -> "%s"' % (package, depend), file=depends_file)
425 for package in depgraph["rdepends-pkg"]: 426 for package in depgraph["rdepends-pkg"]:
426 for rdepend in depgraph["rdepends-pkg"][package]: 427 for rdepend in depgraph["rdepends-pkg"][package]:
427 print >> depends_file, '"%s" -> "%s" [style=dashed]' % (package, rdepend) 428 print('"%s" -> "%s" [style=dashed]' % (package, rdepend), file=depends_file)
428 for package in depgraph["rrecs-pkg"]: 429 for package in depgraph["rrecs-pkg"]:
429 for rdepend in depgraph["rrecs-pkg"][package]: 430 for rdepend in depgraph["rrecs-pkg"][package]:
430 print >> depends_file, '"%s" -> "%s" [style=dashed]' % (package, rdepend) 431 print('"%s" -> "%s" [style=dashed]' % (package, rdepend), file=depends_file)
431 print >> depends_file, "}" 432 print("}", file=depends_file)
432 bb.msg.plain("Package dependencies saved to 'package-depends.dot'") 433 bb.msg.plain("Package dependencies saved to 'package-depends.dot'")
433 434
434 tdepends_file = file('task-depends.dot', 'w' ) 435 tdepends_file = file('task-depends.dot', 'w' )
435 print >> tdepends_file, "digraph depends {" 436 print("digraph depends {", file=tdepends_file)
436 for task in depgraph["tdepends"]: 437 for task in depgraph["tdepends"]:
437 (pn, taskname) = task.rsplit(".", 1) 438 (pn, taskname) = task.rsplit(".", 1)
438 fn = depgraph["pn"][pn]["filename"] 439 fn = depgraph["pn"][pn]["filename"]
439 version = depgraph["pn"][pn]["version"] 440 version = depgraph["pn"][pn]["version"]
440 print >> tdepends_file, '"%s.%s" [label="%s %s\\n%s\\n%s"]' % (pn, taskname, pn, taskname, version, fn) 441 print('"%s.%s" [label="%s %s\\n%s\\n%s"]' % (pn, taskname, pn, taskname, version, fn), file=tdepends_file)
441 for dep in depgraph["tdepends"][task]: 442 for dep in depgraph["tdepends"][task]:
442 print >> tdepends_file, '"%s" -> "%s"' % (task, dep) 443 print('"%s" -> "%s"' % (task, dep), file=tdepends_file)
443 print >> tdepends_file, "}" 444 print("}", file=tdepends_file)
444 bb.msg.plain("Task dependencies saved to 'task-depends.dot'") 445 bb.msg.plain("Task dependencies saved to 'task-depends.dot'")
445 446
446 def buildDepgraph( self ): 447 def buildDepgraph( self ):
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index f0690b4f2b..c0a8db15aa 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -104,13 +104,13 @@ def worker_fire(event, d):
104 data = "<event>" + pickle.dumps(event) + "</event>" 104 data = "<event>" + pickle.dumps(event) + "</event>"
105 try: 105 try:
106 if os.write(worker_pipe, data) != len (data): 106 if os.write(worker_pipe, data) != len (data):
107 print "Error sending event to server (short write)" 107 print("Error sending event to server (short write)")
108 except OSError: 108 except OSError:
109 sys.exit(1) 109 sys.exit(1)
110 110
111def fire_from_worker(event, d): 111def fire_from_worker(event, d):
112 if not event.startswith("<event>") or not event.endswith("</event>"): 112 if not event.startswith("<event>") or not event.endswith("</event>"):
113 print "Error, not an event" 113 print("Error, not an event")
114 return 114 return
115 event = pickle.loads(event[7:-8]) 115 event = pickle.loads(event[7:-8])
116 fire_ui_handlers(event, d) 116 fire_ui_handlers(event, d)
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 09c83b0264..b4d08d6cdd 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -412,7 +412,7 @@ def runfetchcmd(cmd, d, quiet = False):
412 if not line: 412 if not line:
413 break 413 break
414 if not quiet: 414 if not quiet:
415 print line, 415 print(line, end=' ')
416 output += line 416 output += line
417 417
418 status = stdout_handle.close() or 0 418 status = stdout_handle.close() or 0
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index 5332686252..8c91de9db1 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -197,7 +197,7 @@ class Git(Fetch):
197 # Check if we have the rev already 197 # Check if we have the rev already
198 198
199 if not os.path.exists(ud.clonedir): 199 if not os.path.exists(ud.clonedir):
200 print "no repo" 200 print("no repo")
201 self.go(None, ud, d) 201 self.go(None, ud, d)
202 if not os.path.exists(ud.clonedir): 202 if not os.path.exists(ud.clonedir):
203 bb.msg.error(bb.msg.domain.Fetcher, "GIT repository for %s doesn't exist in %s, cannot get sortable buildnumber, using old value" % (url, ud.clonedir)) 203 bb.msg.error(bb.msg.domain.Fetcher, "GIT repository for %s doesn't exist in %s, cannot get sortable buildnumber, using old value" % (url, ud.clonedir))
diff --git a/bitbake/lib/bb/fetch/ssh.py b/bitbake/lib/bb/fetch/ssh.py
index 68e6fdb1df..86c76f4e44 100644
--- a/bitbake/lib/bb/fetch/ssh.py
+++ b/bitbake/lib/bb/fetch/ssh.py
@@ -114,5 +114,5 @@ class SSH(Fetch):
114 114
115 (exitstatus, output) = commands.getstatusoutput(cmd) 115 (exitstatus, output) = commands.getstatusoutput(cmd)
116 if exitstatus != 0: 116 if exitstatus != 0:
117 print output 117 print(output)
118 raise FetchError('Unable to fetch %s' % url) 118 raise FetchError('Unable to fetch %s' % url)
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 788e1dddf7..0d90f959d3 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -110,7 +110,7 @@ def debug(level, msgdomain, msg, fn = None):
110 if debug_level[msgdomain] >= level: 110 if debug_level[msgdomain] >= level:
111 bb.event.fire(MsgDebug(msg), None) 111 bb.event.fire(MsgDebug(msg), None)
112 if not bb.event._ui_handlers: 112 if not bb.event._ui_handlers:
113 print 'DEBUG: ' + msg 113 print('DEBUG: ' + msg)
114 114
115def note(level, msgdomain, msg, fn = None): 115def note(level, msgdomain, msg, fn = None):
116 if not msgdomain: 116 if not msgdomain:
@@ -119,25 +119,25 @@ def note(level, msgdomain, msg, fn = None):
119 if level == 1 or verbose or debug_level[msgdomain] >= 1: 119 if level == 1 or verbose or debug_level[msgdomain] >= 1:
120 bb.event.fire(MsgNote(msg), None) 120 bb.event.fire(MsgNote(msg), None)
121 if not bb.event._ui_handlers: 121 if not bb.event._ui_handlers:
122 print 'NOTE: ' + msg 122 print('NOTE: ' + msg)
123 123
124def warn(msgdomain, msg, fn = None): 124def warn(msgdomain, msg, fn = None):
125 bb.event.fire(MsgWarn(msg), None) 125 bb.event.fire(MsgWarn(msg), None)
126 if not bb.event._ui_handlers: 126 if not bb.event._ui_handlers:
127 print 'WARNING: ' + msg 127 print('WARNING: ' + msg)
128 128
129def error(msgdomain, msg, fn = None): 129def error(msgdomain, msg, fn = None):
130 bb.event.fire(MsgError(msg), None) 130 bb.event.fire(MsgError(msg), None)
131 if not bb.event._ui_handlers: 131 if not bb.event._ui_handlers:
132 print 'ERROR: ' + msg 132 print('ERROR: ' + msg)
133 133
134def fatal(msgdomain, msg, fn = None): 134def fatal(msgdomain, msg, fn = None):
135 bb.event.fire(MsgFatal(msg), None) 135 bb.event.fire(MsgFatal(msg), None)
136 if not bb.event._ui_handlers: 136 if not bb.event._ui_handlers:
137 print 'FATAL: ' + msg 137 print('FATAL: ' + msg)
138 sys.exit(1) 138 sys.exit(1)
139 139
140def plain(msg, fn = None): 140def plain(msg, fn = None):
141 bb.event.fire(MsgPlain(msg), None) 141 bb.event.fire(MsgPlain(msg), None)
142 if not bb.event._ui_handlers: 142 if not bb.event._ui_handlers:
143 print msg 143 print(msg)
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 9881315b9d..de1160eb87 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -852,7 +852,7 @@ class RunQueue:
852 return False 852 return False
853 853
854 if self.state is runQueueChildProcess: 854 if self.state is runQueueChildProcess:
855 print "Child process" 855 print("Child process")
856 return False 856 return False
857 857
858 # Loop 858 # Loop
@@ -1194,5 +1194,5 @@ class runQueuePipe():
1194 while self.read(): 1194 while self.read():
1195 continue 1195 continue
1196 if len(self.queue) > 0: 1196 if len(self.queue) > 0:
1197 print "Warning, worker left partial message" 1197 print("Warning, worker left partial message")
1198 os.close(self.fd) 1198 os.close(self.fd)
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index e1e514fc9a..3844a1e33e 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -42,7 +42,7 @@ from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
42import inspect, select 42import inspect, select
43 43
44if sys.hexversion < 0x020600F0: 44if sys.hexversion < 0x020600F0:
45 print "Sorry, python 2.6 or later is required for bitbake's XMLRPC mode" 45 print("Sorry, python 2.6 or later is required for bitbake's XMLRPC mode")
46 sys.exit(1) 46 sys.exit(1)
47 47
48class BitBakeServerCommands(): 48class BitBakeServerCommands():
@@ -74,7 +74,7 @@ class BitBakeServerCommands():
74 Trigger the server to quit 74 Trigger the server to quit
75 """ 75 """
76 self.server.quit = True 76 self.server.quit = True
77 print "Server (cooker) exitting" 77 print("Server (cooker) exitting")
78 return 78 return
79 79
80 def ping(self): 80 def ping(self):
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py
index 71dd599ed6..0dcf45dd5f 100644
--- a/bitbake/lib/bb/shell.py
+++ b/bitbake/lib/bb/shell.py
@@ -98,7 +98,7 @@ class BitBakeShellCommands:
98 98
99 def _checkParsed( self ): 99 def _checkParsed( self ):
100 if not parsed: 100 if not parsed:
101 print "SHELL: This command needs to parse bbfiles..." 101 print("SHELL: This command needs to parse bbfiles...")
102 self.parse( None ) 102 self.parse( None )
103 103
104 def _findProvider( self, item ): 104 def _findProvider( self, item ):
@@ -119,28 +119,28 @@ class BitBakeShellCommands:
119 """Register a new name for a command""" 119 """Register a new name for a command"""
120 new, old = params 120 new, old = params
121 if not old in cmds: 121 if not old in cmds:
122 print "ERROR: Command '%s' not known" % old 122 print("ERROR: Command '%s' not known" % old)
123 else: 123 else:
124 cmds[new] = cmds[old] 124 cmds[new] = cmds[old]
125 print "OK" 125 print("OK")
126 alias.usage = "<alias> <command>" 126 alias.usage = "<alias> <command>"
127 127
128 def buffer( self, params ): 128 def buffer( self, params ):
129 """Dump specified output buffer""" 129 """Dump specified output buffer"""
130 index = params[0] 130 index = params[0]
131 print self._shell.myout.buffer( int( index ) ) 131 print(self._shell.myout.buffer( int( index ) ))
132 buffer.usage = "<index>" 132 buffer.usage = "<index>"
133 133
134 def buffers( self, params ): 134 def buffers( self, params ):
135 """Show the available output buffers""" 135 """Show the available output buffers"""
136 commands = self._shell.myout.bufferedCommands() 136 commands = self._shell.myout.bufferedCommands()
137 if not commands: 137 if not commands:
138 print "SHELL: No buffered commands available yet. Start doing something." 138 print("SHELL: No buffered commands available yet. Start doing something.")
139 else: 139 else:
140 print "="*35, "Available Output Buffers", "="*27 140 print("="*35, "Available Output Buffers", "="*27)
141 for index, cmd in enumerate( commands ): 141 for index, cmd in enumerate( commands ):
142 print "| %s %s" % ( str( index ).ljust( 3 ), cmd ) 142 print("| %s %s" % ( str( index ).ljust( 3 ), cmd ))
143 print "="*88 143 print("="*88)
144 144
145 def build( self, params, cmd = "build" ): 145 def build( self, params, cmd = "build" ):
146 """Build a providee""" 146 """Build a providee"""
@@ -149,7 +149,7 @@ class BitBakeShellCommands:
149 self._checkParsed() 149 self._checkParsed()
150 names = globfilter( cooker.status.pkg_pn, globexpr ) 150 names = globfilter( cooker.status.pkg_pn, globexpr )
151 if len( names ) == 0: names = [ globexpr ] 151 if len( names ) == 0: names = [ globexpr ]
152 print "SHELL: Building %s" % ' '.join( names ) 152 print("SHELL: Building %s" % ' '.join( names ))
153 153
154 td = taskdata.TaskData(cooker.configuration.abort) 154 td = taskdata.TaskData(cooker.configuration.abort)
155 localdata = data.createCopy(cooker.configuration.data) 155 localdata = data.createCopy(cooker.configuration.data)
@@ -174,16 +174,16 @@ class BitBakeShellCommands:
174 rq.execute_runqueue() 174 rq.execute_runqueue()
175 175
176 except Providers.NoProvider: 176 except Providers.NoProvider:
177 print "ERROR: No Provider" 177 print("ERROR: No Provider")
178 last_exception = Providers.NoProvider 178 last_exception = Providers.NoProvider
179 179
180 except runqueue.TaskFailure, fnids: 180 except runqueue.TaskFailure, fnids:
181 for fnid in fnids: 181 for fnid in fnids:
182 print "ERROR: '%s' failed" % td.fn_index[fnid] 182 print("ERROR: '%s' failed" % td.fn_index[fnid])
183 last_exception = runqueue.TaskFailure 183 last_exception = runqueue.TaskFailure
184 184
185 except build.EventException, e: 185 except build.EventException, e:
186 print "ERROR: Couldn't build '%s'" % names 186 print("ERROR: Couldn't build '%s'" % names)
187 last_exception = e 187 last_exception = e
188 188
189 189
@@ -216,7 +216,7 @@ class BitBakeShellCommands:
216 if bbfile is not None: 216 if bbfile is not None:
217 os.system( "%s %s" % ( os.environ.get( "EDITOR", "vi" ), bbfile ) ) 217 os.system( "%s %s" % ( os.environ.get( "EDITOR", "vi" ), bbfile ) )
218 else: 218 else:
219 print "ERROR: Nothing provides '%s'" % name 219 print("ERROR: Nothing provides '%s'" % name)
220 edit.usage = "<providee>" 220 edit.usage = "<providee>"
221 221
222 def environment( self, params ): 222 def environment( self, params ):
@@ -239,14 +239,14 @@ class BitBakeShellCommands:
239 global last_exception 239 global last_exception
240 name = params[0] 240 name = params[0]
241 bf = completeFilePath( name ) 241 bf = completeFilePath( name )
242 print "SHELL: Calling '%s' on '%s'" % ( cmd, bf ) 242 print("SHELL: Calling '%s' on '%s'" % ( cmd, bf ))
243 243
244 try: 244 try:
245 cooker.buildFile(bf, cmd) 245 cooker.buildFile(bf, cmd)
246 except parse.ParseError: 246 except parse.ParseError:
247 print "ERROR: Unable to open or parse '%s'" % bf 247 print("ERROR: Unable to open or parse '%s'" % bf)
248 except build.EventException, e: 248 except build.EventException, e:
249 print "ERROR: Couldn't build '%s'" % name 249 print("ERROR: Couldn't build '%s'" % name)
250 last_exception = e 250 last_exception = e
251 251
252 fileBuild.usage = "<bbfile>" 252 fileBuild.usage = "<bbfile>"
@@ -270,62 +270,62 @@ class BitBakeShellCommands:
270 def fileReparse( self, params ): 270 def fileReparse( self, params ):
271 """(re)Parse a bb file""" 271 """(re)Parse a bb file"""
272 bbfile = params[0] 272 bbfile = params[0]
273 print "SHELL: Parsing '%s'" % bbfile 273 print("SHELL: Parsing '%s'" % bbfile)
274 parse.update_mtime( bbfile ) 274 parse.update_mtime( bbfile )
275 cooker.bb_cache.cacheValidUpdate(bbfile) 275 cooker.bb_cache.cacheValidUpdate(bbfile)
276 fromCache = cooker.bb_cache.loadData(bbfile, cooker.configuration.data, cooker.status) 276 fromCache = cooker.bb_cache.loadData(bbfile, cooker.configuration.data, cooker.status)
277 cooker.bb_cache.sync() 277 cooker.bb_cache.sync()
278 if False: #fromCache: 278 if False: #fromCache:
279 print "SHELL: File has not been updated, not reparsing" 279 print("SHELL: File has not been updated, not reparsing")
280 else: 280 else:
281 print "SHELL: Parsed" 281 print("SHELL: Parsed")
282 fileReparse.usage = "<bbfile>" 282 fileReparse.usage = "<bbfile>"
283 283
284 def abort( self, params ): 284 def abort( self, params ):
285 """Toggle abort task execution flag (see bitbake -k)""" 285 """Toggle abort task execution flag (see bitbake -k)"""
286 cooker.configuration.abort = not cooker.configuration.abort 286 cooker.configuration.abort = not cooker.configuration.abort
287 print "SHELL: Abort Flag is now '%s'" % repr( cooker.configuration.abort ) 287 print("SHELL: Abort Flag is now '%s'" % repr( cooker.configuration.abort ))
288 288
289 def force( self, params ): 289 def force( self, params ):
290 """Toggle force task execution flag (see bitbake -f)""" 290 """Toggle force task execution flag (see bitbake -f)"""
291 cooker.configuration.force = not cooker.configuration.force 291 cooker.configuration.force = not cooker.configuration.force
292 print "SHELL: Force Flag is now '%s'" % repr( cooker.configuration.force ) 292 print("SHELL: Force Flag is now '%s'" % repr( cooker.configuration.force ))
293 293
294 def help( self, params ): 294 def help( self, params ):
295 """Show a comprehensive list of commands and their purpose""" 295 """Show a comprehensive list of commands and their purpose"""
296 print "="*30, "Available Commands", "="*30 296 print("="*30, "Available Commands", "="*30)
297 for cmd in sorted(cmds): 297 for cmd in sorted(cmds):
298 function, numparams, usage, helptext = cmds[cmd] 298 function, numparams, usage, helptext = cmds[cmd]
299 print "| %s | %s" % (usage.ljust(30), helptext) 299 print("| %s | %s" % (usage.ljust(30), helptext))
300 print "="*78 300 print("="*78)
301 301
302 def lastError( self, params ): 302 def lastError( self, params ):
303 """Show the reason or log that was produced by the last BitBake event exception""" 303 """Show the reason or log that was produced by the last BitBake event exception"""
304 if last_exception is None: 304 if last_exception is None:
305 print "SHELL: No Errors yet (Phew)..." 305 print("SHELL: No Errors yet (Phew)...")
306 else: 306 else:
307 reason, event = last_exception.args 307 reason, event = last_exception.args
308 print "SHELL: Reason for the last error: '%s'" % reason 308 print("SHELL: Reason for the last error: '%s'" % reason)
309 if ':' in reason: 309 if ':' in reason:
310 msg, filename = reason.split( ':' ) 310 msg, filename = reason.split( ':' )
311 filename = filename.strip() 311 filename = filename.strip()
312 print "SHELL: Dumping log file for last error:" 312 print("SHELL: Dumping log file for last error:")
313 try: 313 try:
314 print open( filename ).read() 314 print(open( filename ).read())
315 except IOError: 315 except IOError:
316 print "ERROR: Couldn't open '%s'" % filename 316 print("ERROR: Couldn't open '%s'" % filename)
317 317
318 def match( self, params ): 318 def match( self, params ):
319 """Dump all files or providers matching a glob expression""" 319 """Dump all files or providers matching a glob expression"""
320 what, globexpr = params 320 what, globexpr = params
321 if what == "files": 321 if what == "files":
322 self._checkParsed() 322 self._checkParsed()
323 for key in globfilter( cooker.status.pkg_fn, globexpr ): print key 323 for key in globfilter( cooker.status.pkg_fn, globexpr ): print(key)
324 elif what == "providers": 324 elif what == "providers":
325 self._checkParsed() 325 self._checkParsed()
326 for key in globfilter( cooker.status.pkg_pn, globexpr ): print key 326 for key in globfilter( cooker.status.pkg_pn, globexpr ): print(key)
327 else: 327 else:
328 print "Usage: match %s" % self.print_.usage 328 print("Usage: match %s" % self.print_.usage)
329 match.usage = "<files|providers> <glob>" 329 match.usage = "<files|providers> <glob>"
330 330
331 def new( self, params ): 331 def new( self, params ):
@@ -335,15 +335,15 @@ class BitBakeShellCommands:
335 fulldirname = "%s/%s" % ( packages, dirname ) 335 fulldirname = "%s/%s" % ( packages, dirname )
336 336
337 if not os.path.exists( fulldirname ): 337 if not os.path.exists( fulldirname ):
338 print "SHELL: Creating '%s'" % fulldirname 338 print("SHELL: Creating '%s'" % fulldirname)
339 os.mkdir( fulldirname ) 339 os.mkdir( fulldirname )
340 if os.path.exists( fulldirname ) and os.path.isdir( fulldirname ): 340 if os.path.exists( fulldirname ) and os.path.isdir( fulldirname ):
341 if os.path.exists( "%s/%s" % ( fulldirname, filename ) ): 341 if os.path.exists( "%s/%s" % ( fulldirname, filename ) ):
342 print "SHELL: ERROR: %s/%s already exists" % ( fulldirname, filename ) 342 print("SHELL: ERROR: %s/%s already exists" % ( fulldirname, filename ))
343 return False 343 return False
344 print "SHELL: Creating '%s/%s'" % ( fulldirname, filename ) 344 print("SHELL: Creating '%s/%s'" % ( fulldirname, filename ))
345 newpackage = open( "%s/%s" % ( fulldirname, filename ), "w" ) 345 newpackage = open( "%s/%s" % ( fulldirname, filename ), "w" )
346 print >>newpackage, """DESCRIPTION = "" 346 print("""DESCRIPTION = ""
347SECTION = "" 347SECTION = ""
348AUTHOR = "" 348AUTHOR = ""
349HOMEPAGE = "" 349HOMEPAGE = ""
@@ -370,7 +370,7 @@ SRC_URI = ""
370#do_install() { 370#do_install() {
371# 371#
372#} 372#}
373""" 373""", file=newpackage)
374 newpackage.close() 374 newpackage.close()
375 os.system( "%s %s/%s" % ( os.environ.get( "EDITOR" ), fulldirname, filename ) ) 375 os.system( "%s %s/%s" % ( os.environ.get( "EDITOR" ), fulldirname, filename ) )
376 new.usage = "<directory> <filename>" 376 new.usage = "<directory> <filename>"
@@ -390,14 +390,14 @@ SRC_URI = ""
390 def pasteLog( self, params ): 390 def pasteLog( self, params ):
391 """Send the last event exception error log (if there is one) to http://rafb.net/paste""" 391 """Send the last event exception error log (if there is one) to http://rafb.net/paste"""
392 if last_exception is None: 392 if last_exception is None:
393 print "SHELL: No Errors yet (Phew)..." 393 print("SHELL: No Errors yet (Phew)...")
394 else: 394 else:
395 reason, event = last_exception.args 395 reason, event = last_exception.args
396 print "SHELL: Reason for the last error: '%s'" % reason 396 print("SHELL: Reason for the last error: '%s'" % reason)
397 if ':' in reason: 397 if ':' in reason:
398 msg, filename = reason.split( ':' ) 398 msg, filename = reason.split( ':' )
399 filename = filename.strip() 399 filename = filename.strip()
400 print "SHELL: Pasting log file to pastebin..." 400 print("SHELL: Pasting log file to pastebin...")
401 401
402 file = open( filename ).read() 402 file = open( filename ).read()
403 sendToPastebin( "contents of " + filename, file ) 403 sendToPastebin( "contents of " + filename, file )
@@ -419,23 +419,23 @@ SRC_URI = ""
419 cooker.buildDepgraph() 419 cooker.buildDepgraph()
420 global parsed 420 global parsed
421 parsed = True 421 parsed = True
422 print 422 print()
423 423
424 def reparse( self, params ): 424 def reparse( self, params ):
425 """(re)Parse a providee's bb file""" 425 """(re)Parse a providee's bb file"""
426 bbfile = self._findProvider( params[0] ) 426 bbfile = self._findProvider( params[0] )
427 if bbfile is not None: 427 if bbfile is not None:
428 print "SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] ) 428 print("SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] ))
429 self.fileReparse( [ bbfile ] ) 429 self.fileReparse( [ bbfile ] )
430 else: 430 else:
431 print "ERROR: Nothing provides '%s'" % params[0] 431 print("ERROR: Nothing provides '%s'" % params[0])
432 reparse.usage = "<providee>" 432 reparse.usage = "<providee>"
433 433
434 def getvar( self, params ): 434 def getvar( self, params ):
435 """Dump the contents of an outer BitBake environment variable""" 435 """Dump the contents of an outer BitBake environment variable"""
436 var = params[0] 436 var = params[0]
437 value = data.getVar( var, cooker.configuration.data, 1 ) 437 value = data.getVar( var, cooker.configuration.data, 1 )
438 print value 438 print(value)
439 getvar.usage = "<variable>" 439 getvar.usage = "<variable>"
440 440
441 def peek( self, params ): 441 def peek( self, params ):
@@ -445,9 +445,9 @@ SRC_URI = ""
445 if bbfile is not None: 445 if bbfile is not None:
446 the_data = cooker.bb_cache.loadDataFull(bbfile, cooker.configuration.data) 446 the_data = cooker.bb_cache.loadDataFull(bbfile, cooker.configuration.data)
447 value = the_data.getVar( var, 1 ) 447 value = the_data.getVar( var, 1 )
448 print value 448 print(value)
449 else: 449 else:
450 print "ERROR: Nothing provides '%s'" % name 450 print("ERROR: Nothing provides '%s'" % name)
451 peek.usage = "<providee> <variable>" 451 peek.usage = "<providee> <variable>"
452 452
453 def poke( self, params ): 453 def poke( self, params ):
@@ -455,7 +455,7 @@ SRC_URI = ""
455 name, var, value = params 455 name, var, value = params
456 bbfile = self._findProvider( name ) 456 bbfile = self._findProvider( name )
457 if bbfile is not None: 457 if bbfile is not None:
458 print "ERROR: Sorry, this functionality is currently broken" 458 print("ERROR: Sorry, this functionality is currently broken")
459 #d = cooker.pkgdata[bbfile] 459 #d = cooker.pkgdata[bbfile]
460 #data.setVar( var, value, d ) 460 #data.setVar( var, value, d )
461 461
@@ -463,7 +463,7 @@ SRC_URI = ""
463 #cooker.pkgdata.setDirty(bbfile, d) 463 #cooker.pkgdata.setDirty(bbfile, d)
464 #print "OK" 464 #print "OK"
465 else: 465 else:
466 print "ERROR: Nothing provides '%s'" % name 466 print("ERROR: Nothing provides '%s'" % name)
467 poke.usage = "<providee> <variable> <value>" 467 poke.usage = "<providee> <variable> <value>"
468 468
469 def print_( self, params ): 469 def print_( self, params ):
@@ -471,12 +471,12 @@ SRC_URI = ""
471 what = params[0] 471 what = params[0]
472 if what == "files": 472 if what == "files":
473 self._checkParsed() 473 self._checkParsed()
474 for key in cooker.status.pkg_fn: print key 474 for key in cooker.status.pkg_fn: print(key)
475 elif what == "providers": 475 elif what == "providers":
476 self._checkParsed() 476 self._checkParsed()
477 for key in cooker.status.providers: print key 477 for key in cooker.status.providers: print(key)
478 else: 478 else:
479 print "Usage: print %s" % self.print_.usage 479 print("Usage: print %s" % self.print_.usage)
480 print_.usage = "<files|providers>" 480 print_.usage = "<files|providers>"
481 481
482 def python( self, params ): 482 def python( self, params ):
@@ -496,7 +496,7 @@ SRC_URI = ""
496 """Set an outer BitBake environment variable""" 496 """Set an outer BitBake environment variable"""
497 var, value = params 497 var, value = params
498 data.setVar( var, value, cooker.configuration.data ) 498 data.setVar( var, value, cooker.configuration.data )
499 print "OK" 499 print("OK")
500 setVar.usage = "<variable> <value>" 500 setVar.usage = "<variable> <value>"
501 501
502 def rebuild( self, params ): 502 def rebuild( self, params ):
@@ -508,7 +508,7 @@ SRC_URI = ""
508 def shell( self, params ): 508 def shell( self, params ):
509 """Execute a shell command and dump the output""" 509 """Execute a shell command and dump the output"""
510 if params != "": 510 if params != "":
511 print commands.getoutput( " ".join( params ) ) 511 print(commands.getoutput( " ".join( params ) ))
512 shell.usage = "<...>" 512 shell.usage = "<...>"
513 513
514 def stage( self, params ): 514 def stage( self, params ):
@@ -518,17 +518,17 @@ SRC_URI = ""
518 518
519 def status( self, params ): 519 def status( self, params ):
520 """<just for testing>""" 520 """<just for testing>"""
521 print "-" * 78 521 print("-" * 78)
522 print "building list = '%s'" % cooker.building_list 522 print("building list = '%s'" % cooker.building_list)
523 print "build path = '%s'" % cooker.build_path 523 print("build path = '%s'" % cooker.build_path)
524 print "consider_msgs_cache = '%s'" % cooker.consider_msgs_cache 524 print("consider_msgs_cache = '%s'" % cooker.consider_msgs_cache)
525 print "build stats = '%s'" % cooker.stats 525 print("build stats = '%s'" % cooker.stats)
526 if last_exception is not None: print "last_exception = '%s'" % repr( last_exception.args ) 526 if last_exception is not None: print("last_exception = '%s'" % repr( last_exception.args ))
527 print "memory output contents = '%s'" % self._shell.myout._buffer 527 print("memory output contents = '%s'" % self._shell.myout._buffer)
528 528
529 def test( self, params ): 529 def test( self, params ):
530 """<just for testing>""" 530 """<just for testing>"""
531 print "testCommand called with '%s'" % params 531 print("testCommand called with '%s'" % params)
532 532
533 def unpack( self, params ): 533 def unpack( self, params ):
534 """Execute 'unpack' on a providee""" 534 """Execute 'unpack' on a providee"""
@@ -553,12 +553,12 @@ SRC_URI = ""
553 try: 553 try:
554 providers = cooker.status.providers[item] 554 providers = cooker.status.providers[item]
555 except KeyError: 555 except KeyError:
556 print "SHELL: ERROR: Nothing provides", preferred 556 print("SHELL: ERROR: Nothing provides", preferred)
557 else: 557 else:
558 for provider in providers: 558 for provider in providers:
559 if provider == pf: provider = " (***) %s" % provider 559 if provider == pf: provider = " (***) %s" % provider
560 else: provider = " %s" % provider 560 else: provider = " %s" % provider
561 print provider 561 print(provider)
562 which.usage = "<providee>" 562 which.usage = "<providee>"
563 563
564########################################################################## 564##########################################################################
@@ -594,9 +594,9 @@ def sendToPastebin( desc, content ):
594 594
595 if response.status == 302: 595 if response.status == 302:
596 location = response.getheader( "location" ) or "unknown" 596 location = response.getheader( "location" ) or "unknown"
597 print "SHELL: Pasted to http://%s%s" % ( host, location ) 597 print("SHELL: Pasted to http://%s%s" % ( host, location ))
598 else: 598 else:
599 print "ERROR: %s %s" % ( response.status, response.reason ) 599 print("ERROR: %s %s" % ( response.status, response.reason ))
600 600
601def completer( text, state ): 601def completer( text, state ):
602 """Return a possible readline completion""" 602 """Return a possible readline completion"""
@@ -718,7 +718,7 @@ class BitBakeShell:
718 except IOError: 718 except IOError:
719 pass # It doesn't exist yet. 719 pass # It doesn't exist yet.
720 720
721 print __credits__ 721 print(__credits__)
722 722
723 def cleanup( self ): 723 def cleanup( self ):
724 """Write readline history and clean up resources""" 724 """Write readline history and clean up resources"""
@@ -726,7 +726,7 @@ class BitBakeShell:
726 try: 726 try:
727 readline.write_history_file( self.historyfilename ) 727 readline.write_history_file( self.historyfilename )
728 except: 728 except:
729 print "SHELL: Unable to save command history" 729 print("SHELL: Unable to save command history")
730 730
731 def registerCommand( self, command, function, numparams = 0, usage = "", helptext = "" ): 731 def registerCommand( self, command, function, numparams = 0, usage = "", helptext = "" ):
732 """Register a command""" 732 """Register a command"""
@@ -740,11 +740,11 @@ class BitBakeShell:
740 try: 740 try:
741 function, numparams, usage, helptext = cmds[command] 741 function, numparams, usage, helptext = cmds[command]
742 except KeyError: 742 except KeyError:
743 print "SHELL: ERROR: '%s' command is not a valid command." % command 743 print("SHELL: ERROR: '%s' command is not a valid command." % command)
744 self.myout.removeLast() 744 self.myout.removeLast()
745 else: 745 else:
746 if (numparams != -1) and (not len( params ) == numparams): 746 if (numparams != -1) and (not len( params ) == numparams):
747 print "Usage: '%s'" % usage 747 print("Usage: '%s'" % usage)
748 return 748 return
749 749
750 result = function( self.commands, params ) 750 result = function( self.commands, params )
@@ -759,7 +759,7 @@ class BitBakeShell:
759 if not cmdline: 759 if not cmdline:
760 continue 760 continue
761 if "|" in cmdline: 761 if "|" in cmdline:
762 print "ERROR: '|' in startup file is not allowed. Ignoring line" 762 print("ERROR: '|' in startup file is not allowed. Ignoring line")
763 continue 763 continue
764 self.commandQ.put( cmdline.strip() ) 764 self.commandQ.put( cmdline.strip() )
765 765
@@ -801,10 +801,10 @@ class BitBakeShell:
801 sys.stdout.write( pipe.fromchild.read() ) 801 sys.stdout.write( pipe.fromchild.read() )
802 # 802 #
803 except EOFError: 803 except EOFError:
804 print 804 print()
805 return 805 return
806 except KeyboardInterrupt: 806 except KeyboardInterrupt:
807 print 807 print()
808 808
809########################################################################## 809##########################################################################
810# Start function - called from the BitBake command line utility 810# Start function - called from the BitBake command line utility
@@ -819,4 +819,4 @@ def start( aCooker ):
819 bbshell.cleanup() 819 bbshell.cleanup()
820 820
821if __name__ == "__main__": 821if __name__ == "__main__":
822 print "SHELL: Sorry, this program should only be called by BitBake." 822 print("SHELL: Sorry, this program should only be called by BitBake.")
diff --git a/bitbake/lib/bb/ui/crumbs/buildmanager.py b/bitbake/lib/bb/ui/crumbs/buildmanager.py
index f5a15329d5..37a62f189f 100644
--- a/bitbake/lib/bb/ui/crumbs/buildmanager.py
+++ b/bitbake/lib/bb/ui/crumbs/buildmanager.py
@@ -158,7 +158,7 @@ class BuildResult(gobject.GObject):
158 # pull it out. 158 # pull it out.
159 # TODO: Better to stat a file? 159 # TODO: Better to stat a file?
160 (_ , date, revision) = identifier.split ("-") 160 (_ , date, revision) = identifier.split ("-")
161 print date 161 print(date)
162 162
163 year = int (date[0:4]) 163 year = int (date[0:4])
164 month = int (date[4:6]) 164 month = int (date[4:6])
@@ -386,7 +386,7 @@ class BuildManager (gobject.GObject):
386 server.runCommand(["buildTargets", [conf.image], "rootfs"]) 386 server.runCommand(["buildTargets", [conf.image], "rootfs"])
387 387
388 except Exception, e: 388 except Exception, e:
389 print e 389 print(e)
390 390
391class BuildManagerTreeView (gtk.TreeView): 391class BuildManagerTreeView (gtk.TreeView):
392 """ The tree view for the build manager. This shows the historic builds 392 """ The tree view for the build manager. This shows the historic builds
diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py
index c596cad5cf..e386e34958 100644
--- a/bitbake/lib/bb/ui/depexp.py
+++ b/bitbake/lib/bb/ui/depexp.py
@@ -201,14 +201,14 @@ def init(server, eventHandler):
201 try: 201 try:
202 cmdline = server.runCommand(["getCmdLineAction"]) 202 cmdline = server.runCommand(["getCmdLineAction"])
203 if not cmdline or cmdline[0] != "generateDotGraph": 203 if not cmdline or cmdline[0] != "generateDotGraph":
204 print "This UI is only compatible with the -g option" 204 print("This UI is only compatible with the -g option")
205 return 205 return
206 ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]]) 206 ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]])
207 if ret != True: 207 if ret != True:
208 print "Couldn't run command! %s" % ret 208 print("Couldn't run command! %s" % ret)
209 return 209 return
210 except xmlrpclib.Fault, x: 210 except xmlrpclib.Fault, x:
211 print "XMLRPC Fault getting commandline:\n %s" % x 211 print("XMLRPC Fault getting commandline:\n %s" % x)
212 return 212 return
213 213
214 shutdown = 0 214 shutdown = 0
@@ -233,8 +233,8 @@ def init(server, eventHandler):
233 x = event.sofar 233 x = event.sofar
234 y = event.total 234 y = event.total
235 if x == y: 235 if x == y:
236 print("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors." 236 print(("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors."
237 % ( event.cached, event.parsed, event.skipped, event.masked, event.errors)) 237 % ( event.cached, event.parsed, event.skipped, event.masked, event.errors)))
238 pbar.hide() 238 pbar.hide()
239 gtk.gdk.threads_enter() 239 gtk.gdk.threads_enter()
240 pbar.progress.set_fraction(float(x)/float(y)) 240 pbar.progress.set_fraction(float(x)/float(y))
@@ -250,7 +250,7 @@ def init(server, eventHandler):
250 if isinstance(event, bb.command.CookerCommandCompleted): 250 if isinstance(event, bb.command.CookerCommandCompleted):
251 continue 251 continue
252 if isinstance(event, bb.command.CookerCommandFailed): 252 if isinstance(event, bb.command.CookerCommandFailed):
253 print "Command execution failed: %s" % event.error 253 print("Command execution failed: %s" % event.error)
254 break 254 break
255 if isinstance(event, bb.cooker.CookerExit): 255 if isinstance(event, bb.cooker.CookerExit):
256 break 256 break
@@ -259,13 +259,13 @@ def init(server, eventHandler):
259 259
260 except KeyboardInterrupt: 260 except KeyboardInterrupt:
261 if shutdown == 2: 261 if shutdown == 2:
262 print "\nThird Keyboard Interrupt, exit.\n" 262 print("\nThird Keyboard Interrupt, exit.\n")
263 break 263 break
264 if shutdown == 1: 264 if shutdown == 1:
265 print "\nSecond Keyboard Interrupt, stopping...\n" 265 print("\nSecond Keyboard Interrupt, stopping...\n")
266 server.runCommand(["stateStop"]) 266 server.runCommand(["stateStop"])
267 if shutdown == 0: 267 if shutdown == 0:
268 print "\nKeyboard Interrupt, closing down...\n" 268 print("\nKeyboard Interrupt, closing down...\n")
269 server.runCommand(["stateShutdown"]) 269 server.runCommand(["stateShutdown"])
270 shutdown = shutdown + 1 270 shutdown = shutdown + 1
271 pass 271 pass
diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py
index bcba38be9c..7a3427f715 100644
--- a/bitbake/lib/bb/ui/goggle.py
+++ b/bitbake/lib/bb/ui/goggle.py
@@ -55,15 +55,15 @@ def init (server, eventHandler):
55 window.cur_build_tv.set_model (running_build.model) 55 window.cur_build_tv.set_model (running_build.model)
56 try: 56 try:
57 cmdline = server.runCommand(["getCmdLineAction"]) 57 cmdline = server.runCommand(["getCmdLineAction"])
58 print cmdline 58 print(cmdline)
59 if not cmdline: 59 if not cmdline:
60 return 1 60 return 1
61 ret = server.runCommand(cmdline) 61 ret = server.runCommand(cmdline)
62 if ret != True: 62 if ret != True:
63 print "Couldn't get default commandline! %s" % ret 63 print("Couldn't get default commandline! %s" % ret)
64 return 1 64 return 1
65 except xmlrpclib.Fault, x: 65 except xmlrpclib.Fault, x:
66 print "XMLRPC Fault getting commandline:\n %s" % x 66 print("XMLRPC Fault getting commandline:\n %s" % x)
67 return 1 67 return 1
68 68
69 # Use a timeout function for probing the event queue to find out if we 69 # Use a timeout function for probing the event queue to find out if we
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 3261792dfc..dba9530ef6 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -44,10 +44,10 @@ def init(server, eventHandler):
44 return 1 44 return 1
45 ret = server.runCommand(cmdline) 45 ret = server.runCommand(cmdline)
46 if ret != True: 46 if ret != True:
47 print "Couldn't get default commandline! %s" % ret 47 print("Couldn't get default commandline! %s" % ret)
48 return 1 48 return 1
49 except xmlrpclib.Fault, x: 49 except xmlrpclib.Fault, x:
50 print "XMLRPC Fault getting commandline:\n %s" % x 50 print("XMLRPC Fault getting commandline:\n %s" % x)
51 return 1 51 return 1
52 52
53 shutdown = 0 53 shutdown = 0
@@ -65,39 +65,39 @@ def init(server, eventHandler):
65 if shutdown and helper.needUpdate: 65 if shutdown and helper.needUpdate:
66 activetasks, failedtasks = helper.getTasks() 66 activetasks, failedtasks = helper.getTasks()
67 if activetasks: 67 if activetasks:
68 print "Waiting for %s active tasks to finish:" % len(activetasks) 68 print("Waiting for %s active tasks to finish:" % len(activetasks))
69 tasknum = 1 69 tasknum = 1
70 for task in activetasks: 70 for task in activetasks:
71 print "%s: %s (pid %s)" % (tasknum, activetasks[task]["title"], task) 71 print("%s: %s (pid %s)" % (tasknum, activetasks[task]["title"], task))
72 tasknum = tasknum + 1 72 tasknum = tasknum + 1
73 73
74 if isinstance(event, bb.msg.MsgPlain): 74 if isinstance(event, bb.msg.MsgPlain):
75 print event._message 75 print(event._message)
76 continue 76 continue
77 if isinstance(event, bb.msg.MsgDebug): 77 if isinstance(event, bb.msg.MsgDebug):
78 print 'DEBUG: ' + event._message 78 print('DEBUG: ' + event._message)
79 continue 79 continue
80 if isinstance(event, bb.msg.MsgNote): 80 if isinstance(event, bb.msg.MsgNote):
81 print 'NOTE: ' + event._message 81 print('NOTE: ' + event._message)
82 continue 82 continue
83 if isinstance(event, bb.msg.MsgWarn): 83 if isinstance(event, bb.msg.MsgWarn):
84 print 'WARNING: ' + event._message 84 print('WARNING: ' + event._message)
85 continue 85 continue
86 if isinstance(event, bb.msg.MsgError): 86 if isinstance(event, bb.msg.MsgError):
87 return_value = 1 87 return_value = 1
88 print 'ERROR: ' + event._message 88 print('ERROR: ' + event._message)
89 continue 89 continue
90 if isinstance(event, bb.msg.MsgFatal): 90 if isinstance(event, bb.msg.MsgFatal):
91 return_value = 1 91 return_value = 1
92 print 'FATAL: ' + event._message 92 print('FATAL: ' + event._message)
93 break 93 break
94 if isinstance(event, bb.build.TaskFailed): 94 if isinstance(event, bb.build.TaskFailed):
95 return_value = 1 95 return_value = 1
96 logfile = event.logfile 96 logfile = event.logfile
97 if logfile: 97 if logfile:
98 print "ERROR: Logfile of failure stored in: %s" % logfile 98 print("ERROR: Logfile of failure stored in: %s" % logfile)
99 if 1 or includelogs: 99 if 1 or includelogs:
100 print "Log data follows:" 100 print("Log data follows:")
101 f = open(logfile, "r") 101 f = open(logfile, "r")
102 lines = [] 102 lines = []
103 while True: 103 while True:
@@ -110,13 +110,13 @@ def init(server, eventHandler):
110 if len(lines) > int(loglines): 110 if len(lines) > int(loglines):
111 lines.pop(0) 111 lines.pop(0)
112 else: 112 else:
113 print '| %s' % l 113 print('| %s' % l)
114 f.close() 114 f.close()
115 if lines: 115 if lines:
116 for line in lines: 116 for line in lines:
117 print line 117 print(line)
118 if isinstance(event, bb.build.TaskBase): 118 if isinstance(event, bb.build.TaskBase):
119 print "NOTE: %s" % event._message 119 print("NOTE: %s" % event._message)
120 continue 120 continue
121 if isinstance(event, bb.event.ParseProgress): 121 if isinstance(event, bb.event.ParseProgress):
122 x = event.sofar 122 x = event.sofar
@@ -132,8 +132,8 @@ def init(server, eventHandler):
132 sys.stdout.write("done.") 132 sys.stdout.write("done.")
133 sys.stdout.flush() 133 sys.stdout.flush()
134 if x == y: 134 if x == y:
135 print("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." 135 print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
136 % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)) 136 % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
137 continue 137 continue
138 138
139 if isinstance(event, bb.command.CookerCommandCompleted): 139 if isinstance(event, bb.command.CookerCommandCompleted):
@@ -143,7 +143,7 @@ def init(server, eventHandler):
143 continue 143 continue
144 if isinstance(event, bb.command.CookerCommandFailed): 144 if isinstance(event, bb.command.CookerCommandFailed):
145 return_value = 1 145 return_value = 1
146 print "Command execution failed: %s" % event.error 146 print("Command execution failed: %s" % event.error)
147 break 147 break
148 if isinstance(event, bb.cooker.CookerExit): 148 if isinstance(event, bb.cooker.CookerExit):
149 break 149 break
@@ -165,17 +165,17 @@ def init(server, eventHandler):
165 continue 165 continue
166 if isinstance(event, bb.event.RecipeParsed): 166 if isinstance(event, bb.event.RecipeParsed):
167 continue 167 continue
168 print "Unknown Event: %s" % event 168 print("Unknown Event: %s" % event)
169 169
170 except KeyboardInterrupt: 170 except KeyboardInterrupt:
171 if shutdown == 2: 171 if shutdown == 2:
172 print "\nThird Keyboard Interrupt, exit.\n" 172 print("\nThird Keyboard Interrupt, exit.\n")
173 break 173 break
174 if shutdown == 1: 174 if shutdown == 1:
175 print "\nSecond Keyboard Interrupt, stopping...\n" 175 print("\nSecond Keyboard Interrupt, stopping...\n")
176 server.runCommand(["stateStop"]) 176 server.runCommand(["stateStop"])
177 if shutdown == 0: 177 if shutdown == 0:
178 print "\nKeyboard Interrupt, closing down...\n" 178 print("\nKeyboard Interrupt, closing down...\n")
179 server.runCommand(["stateShutdown"]) 179 server.runCommand(["stateShutdown"])
180 shutdown = shutdown + 1 180 shutdown = shutdown + 1
181 pass 181 pass
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py
index 0eb1cf013b..89e67900b2 100644
--- a/bitbake/lib/bb/ui/ncurses.py
+++ b/bitbake/lib/bb/ui/ncurses.py
@@ -232,10 +232,10 @@ class NCursesUI:
232 return 232 return
233 ret = server.runCommand(cmdline) 233 ret = server.runCommand(cmdline)
234 if ret != True: 234 if ret != True:
235 print "Couldn't get default commandlind! %s" % ret 235 print("Couldn't get default commandlind! %s" % ret)
236 return 236 return
237 except xmlrpclib.Fault, x: 237 except xmlrpclib.Fault, x:
238 print "XMLRPC Fault getting commandline:\n %s" % x 238 print("XMLRPC Fault getting commandline:\n %s" % x)
239 return 239 return
240 240
241 exitflag = False 241 exitflag = False
@@ -324,7 +324,7 @@ class NCursesUI:
324 324
325def init(server, eventHandler): 325def init(server, eventHandler):
326 if not os.isatty(sys.stdout.fileno()): 326 if not os.isatty(sys.stdout.fileno()):
327 print "FATAL: Unable to run 'ncurses' UI without a TTY." 327 print("FATAL: Unable to run 'ncurses' UI without a TTY.")
328 return 328 return
329 ui = NCursesUI() 329 ui = NCursesUI()
330 try: 330 try:
diff --git a/bitbake/lib/bb/ui/puccho.py b/bitbake/lib/bb/ui/puccho.py
index dfcb0f7651..7dffa5c3ba 100644
--- a/bitbake/lib/bb/ui/puccho.py
+++ b/bitbake/lib/bb/ui/puccho.py
@@ -110,7 +110,7 @@ class MetaDataLoader(gobject.GObject):
110 except Exception, e: 110 except Exception, e:
111 gobject.idle_add (MetaDataLoader.emit_error_signal, self.loader, 111 gobject.idle_add (MetaDataLoader.emit_error_signal, self.loader,
112 "Unable to download repository metadata") 112 "Unable to download repository metadata")
113 print e 113 print(e)
114 114
115 def try_fetch_from_url (self, url): 115 def try_fetch_from_url (self, url):
116 # Try and download the metadata. Firing a signal if successful 116 # Try and download the metadata. Firing a signal if successful
@@ -326,8 +326,8 @@ class MainWindow (gtk.Window):
326 conf = None 326 conf = None
327 if (response_id == BuildSetupDialog.RESPONSE_BUILD): 327 if (response_id == BuildSetupDialog.RESPONSE_BUILD):
328 dialog.update_configuration() 328 dialog.update_configuration()
329 print dialog.configuration.machine, dialog.configuration.distro, \ 329 print(dialog.configuration.machine, dialog.configuration.distro, \
330 dialog.configuration.image 330 dialog.configuration.image)
331 conf = dialog.configuration 331 conf = dialog.configuration
332 332
333 dialog.destroy() 333 dialog.destroy()
@@ -383,11 +383,11 @@ def running_build_succeeded_cb (running_build, manager):
383 # BuildManager. It can then hook onto the signals directly and drive 383 # BuildManager. It can then hook onto the signals directly and drive
384 # interesting things it cares about. 384 # interesting things it cares about.
385 manager.notify_build_succeeded () 385 manager.notify_build_succeeded ()
386 print "build succeeded" 386 print("build succeeded")
387 387
388def running_build_failed_cb (running_build, manager): 388def running_build_failed_cb (running_build, manager):
389 # As above 389 # As above
390 print "build failed" 390 print("build failed")
391 manager.notify_build_failed () 391 manager.notify_build_failed ()
392 392
393def init (server, eventHandler): 393def init (server, eventHandler):
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 5c6aafd1fa..7446be875d 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -562,7 +562,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
562 if not sstat: 562 if not sstat:
563 sstat = os.lstat(src) 563 sstat = os.lstat(src)
564 except Exception, e: 564 except Exception, e:
565 print "movefile: Stating source file failed...", e 565 print("movefile: Stating source file failed...", e)
566 return None 566 return None
567 567
568 destexists = 1 568 destexists = 1
@@ -590,7 +590,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
590 os.unlink(src) 590 os.unlink(src)
591 return os.lstat(dest) 591 return os.lstat(dest)
592 except Exception, e: 592 except Exception, e:
593 print "movefile: failed to properly create symlink:", dest, "->", target, e 593 print("movefile: failed to properly create symlink:", dest, "->", target, e)
594 return None 594 return None
595 595
596 renamefailed = 1 596 renamefailed = 1
@@ -601,7 +601,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
601 except Exception, e: 601 except Exception, e:
602 if e[0] != errno.EXDEV: 602 if e[0] != errno.EXDEV:
603 # Some random error. 603 # Some random error.
604 print "movefile: Failed to move", src, "to", dest, e 604 print("movefile: Failed to move", src, "to", dest, e)
605 return None 605 return None
606 # Invalid cross-device-link 'bind' mounted or actually Cross-Device 606 # Invalid cross-device-link 'bind' mounted or actually Cross-Device
607 607
@@ -613,13 +613,13 @@ def movefile(src, dest, newmtime = None, sstat = None):
613 os.rename(dest + "#new", dest) 613 os.rename(dest + "#new", dest)
614 didcopy = 1 614 didcopy = 1
615 except Exception, e: 615 except Exception, e:
616 print 'movefile: copy', src, '->', dest, 'failed.', e 616 print('movefile: copy', src, '->', dest, 'failed.', e)
617 return None 617 return None
618 else: 618 else:
619 #we don't yet handle special, so we need to fall back to /bin/mv 619 #we don't yet handle special, so we need to fall back to /bin/mv
620 a = getstatusoutput("/bin/mv -f " + "'" + src + "' '" + dest + "'") 620 a = getstatusoutput("/bin/mv -f " + "'" + src + "' '" + dest + "'")
621 if a[0] != 0: 621 if a[0] != 0:
622 print "movefile: Failed to move special file:" + src + "' to '" + dest + "'", a 622 print("movefile: Failed to move special file:" + src + "' to '" + dest + "'", a)
623 return None # failure 623 return None # failure
624 try: 624 try:
625 if didcopy: 625 if didcopy:
@@ -627,7 +627,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
627 os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown 627 os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
628 os.unlink(src) 628 os.unlink(src)
629 except Exception, e: 629 except Exception, e:
630 print "movefile: Failed to chown/chmod/unlink", dest, e 630 print("movefile: Failed to chown/chmod/unlink", dest, e)
631 return None 631 return None
632 632
633 if newmtime: 633 if newmtime:
@@ -648,7 +648,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
648 if not sstat: 648 if not sstat:
649 sstat = os.lstat(src) 649 sstat = os.lstat(src)
650 except Exception, e: 650 except Exception, e:
651 print "copyfile: Stating source file failed...", e 651 print("copyfile: Stating source file failed...", e)
652 return False 652 return False
653 653
654 destexists = 1 654 destexists = 1
@@ -675,7 +675,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
675 #os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) 675 #os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
676 return os.lstat(dest) 676 return os.lstat(dest)
677 except Exception, e: 677 except Exception, e:
678 print "copyfile: failed to properly create symlink:", dest, "->", target, e 678 print("copyfile: failed to properly create symlink:", dest, "->", target, e)
679 return False 679 return False
680 680
681 if stat.S_ISREG(sstat[stat.ST_MODE]): 681 if stat.S_ISREG(sstat[stat.ST_MODE]):
@@ -683,19 +683,19 @@ def copyfile(src, dest, newmtime = None, sstat = None):
683 shutil.copyfile(src, dest + "#new") 683 shutil.copyfile(src, dest + "#new")
684 os.rename(dest + "#new", dest) 684 os.rename(dest + "#new", dest)
685 except Exception, e: 685 except Exception, e:
686 print 'copyfile: copy', src, '->', dest, 'failed.', e 686 print('copyfile: copy', src, '->', dest, 'failed.', e)
687 return False 687 return False
688 else: 688 else:
689 #we don't yet handle special, so we need to fall back to /bin/mv 689 #we don't yet handle special, so we need to fall back to /bin/mv
690 a = getstatusoutput("/bin/cp -f " + "'" + src + "' '" + dest + "'") 690 a = getstatusoutput("/bin/cp -f " + "'" + src + "' '" + dest + "'")
691 if a[0] != 0: 691 if a[0] != 0:
692 print "copyfile: Failed to copy special file:" + src + "' to '" + dest + "'", a 692 print("copyfile: Failed to copy special file:" + src + "' to '" + dest + "'", a)
693 return False # failure 693 return False # failure
694 try: 694 try:
695 os.lchown(dest, sstat[stat.ST_UID], sstat[stat.ST_GID]) 695 os.lchown(dest, sstat[stat.ST_UID], sstat[stat.ST_GID])
696 os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown 696 os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
697 except Exception, e: 697 except Exception, e:
698 print "copyfile: Failed to chown/chmod/unlink", dest, e 698 print("copyfile: Failed to chown/chmod/unlink", dest, e)
699 return False 699 return False
700 700
701 if newmtime: 701 if newmtime: