summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-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 224213db5..b0afb5fa0 100644
--- a/bitbake/lib/bb/COW.py
+++ b/bitbake/lib/bb/COW.py
@@ -23,6 +23,7 @@
# Assign a file to __warn__ to get warnings about slow operations.
#
+from __future__ import print_function
import copy
import types
types.ImmutableTypes = tuple([ \
@@ -77,7 +78,7 @@ class COWDictMeta(COWMeta):
return value
if not cls.__warn__ is False and not isinstance(value, COWMeta):
- print >> cls.__warn__, "Warning: Doing a copy because %s is a mutable type." % key
+ print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__)
try:
value = value.copy()
except AttributeError, e:
@@ -153,11 +154,11 @@ class COWDictMeta(COWMeta):
return cls.iter("keys")
def itervalues(cls, readonly=False):
if not cls.__warn__ is False and cls.__hasmutable__ and readonly is False:
- print >> cls.__warn__, "Warning: If you arn't going to change any of the values call with True."
+ print("Warning: If you arn't going to change any of the values call with True.", file=cls.__warn__)
return cls.iter("values", readonly)
def iteritems(cls, readonly=False):
if not cls.__warn__ is False and cls.__hasmutable__ and readonly is False:
- print >> cls.__warn__, "Warning: If you arn't going to change any of the values call with True."
+ print("Warning: If you arn't going to change any of the values call with True.", file=cls.__warn__)
return cls.iter("items", readonly)
class COWSetMeta(COWDictMeta):
@@ -199,120 +200,120 @@ if __name__ == "__main__":
import sys
COWDictBase.__warn__ = sys.stderr
a = COWDictBase()
- print "a", a
+ print("a", a)
a['a'] = 'a'
a['b'] = 'b'
a['dict'] = {}
b = a.copy()
- print "b", b
+ print("b", b)
b['c'] = 'b'
- print
+ print()
- print "a", a
+ print("a", a)
for x in a.iteritems():
- print x
- print "--"
- print "b", b
+ print(x)
+ print("--")
+ print("b", b)
for x in b.iteritems():
- print x
- print
+ print(x)
+ print()
b['dict']['a'] = 'b'
b['a'] = 'c'
- print "a", a
+ print("a", a)
for x in a.iteritems():
- print x
- print "--"
- print "b", b
+ print(x)
+ print("--")
+ print("b", b)
for x in b.iteritems():
- print x
- print
+ print(x)
+ print()
try:
b['dict2']
except KeyError, e:
- print "Okay!"
+ print("Okay!")
a['set'] = COWSetBase()
a['set'].add("o1")
a['set'].add("o1")
a['set'].add("o2")
- print "a", a
+ print("a", a)
for x in a['set'].itervalues():
- print x
- print "--"
- print "b", b
+ print(x)
+ print("--")
+ print("b", b)
for x in b['set'].itervalues():
- print x
- print
+ print(x)
+ print()
b['set'].add('o3')
- print "a", a
+ print("a", a)
for x in a['set'].itervalues():
- print x
- print "--"
- print "b", b
+ print(x)
+ print("--")
+ print("b", b)
for x in b['set'].itervalues():
- print x
- print
+ print(x)
+ print()
a['set2'] = set()
a['set2'].add("o1")
a['set2'].add("o1")
a['set2'].add("o2")
- print "a", a
+ print("a", a)
for x in a.iteritems():
- print x
- print "--"
- print "b", b
+ print(x)
+ print("--")
+ print("b", b)
for x in b.iteritems(readonly=True):
- print x
- print
+ print(x)
+ print()
del b['b']
try:
- print b['b']
+ print(b['b'])
except KeyError:
- print "Yay! deleted key raises error"
+ print("Yay! deleted key raises error")
if b.has_key('b'):
- print "Boo!"
+ print("Boo!")
else:
- print "Yay - has_key with delete works!"
+ print("Yay - has_key with delete works!")
- print "a", a
+ print("a", a)
for x in a.iteritems():
- print x
- print "--"
- print "b", b
+ print(x)
+ print("--")
+ print("b", b)
for x in b.iteritems(readonly=True):
- print x
- print
+ print(x)
+ print()
b.__revertitem__('b')
- print "a", a
+ print("a", a)
for x in a.iteritems():
- print x
- print "--"
- print "b", b
+ print(x)
+ print("--")
+ print("b", b)
for x in b.iteritems(readonly=True):
- print x
- print
+ print(x)
+ print()
b.__revertitem__('dict')
- print "a", a
+ print("a", a)
for x in a.iteritems():
- print x
- print "--"
- print "b", b
+ print(x)
+ print("--")
+ print("b", b)
for x in b.iteritems(readonly=True):
- print x
- print
+ print(x)
+ print()
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 6090efcad..eaee797cb 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -22,6 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from __future__ import print_function
import sys, os, glob, os.path, re, time
import bb
from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue
@@ -396,51 +397,51 @@ class BBCooker:
# Prints a flattened form of package-depends below where subpackages of a package are merged into the main pn
depends_file = file('pn-depends.dot', 'w' )
- print >> depends_file, "digraph depends {"
+ print("digraph depends {", file=depends_file)
for pn in depgraph["pn"]:
fn = depgraph["pn"][pn]["filename"]
version = depgraph["pn"][pn]["version"]
- print >> depends_file, '"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn)
+ print('"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn), file=depends_file)
for pn in depgraph["depends"]:
for depend in depgraph["depends"][pn]:
- print >> depends_file, '"%s" -> "%s"' % (pn, depend)
+ print('"%s" -> "%s"' % (pn, depend), file=depends_file)
for pn in depgraph["rdepends-pn"]:
for rdepend in depgraph["rdepends-pn"][pn]:
- print >> depends_file, '"%s" -> "%s" [style=dashed]' % (pn, rdepend)
- print >> depends_file, "}"
+ print('"%s" -> "%s" [style=dashed]' % (pn, rdepend), file=depends_file)
+ print("}", file=depends_file)
bb.msg.plain("PN dependencies saved to 'pn-depends.dot'")
depends_file = file('package-depends.dot', 'w' )
- print >> depends_file, "digraph depends {"
+ print("digraph depends {", file=depends_file)
for package in depgraph["packages"]:
pn = depgraph["packages"][package]["pn"]
fn = depgraph["packages"][package]["filename"]
version = depgraph["packages"][package]["version"]
if package == pn:
- print >> depends_file, '"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn)
+ print('"%s" [label="%s %s\\n%s"]' % (pn, pn, version, fn), file=depends_file)
else:
- print >> depends_file, '"%s" [label="%s(%s) %s\\n%s"]' % (package, package, pn, version, fn)
+ print('"%s" [label="%s(%s) %s\\n%s"]' % (package, package, pn, version, fn), file=depends_file)
for depend in depgraph["depends"][pn]:
- print >> depends_file, '"%s" -> "%s"' % (package, depend)
+ print('"%s" -> "%s"' % (package, depend), file=depends_file)
for package in depgraph["rdepends-pkg"]:
for rdepend in depgraph["rdepends-pkg"][package]:
- print >> depends_file, '"%s" -> "%s" [style=dashed]' % (package, rdepend)
+ print('"%s" -> "%s" [style=dashed]' % (package, rdepend), file=depends_file)
for package in depgraph["rrecs-pkg"]:
for rdepend in depgraph["rrecs-pkg"][package]:
- print >> depends_file, '"%s" -> "%s" [style=dashed]' % (package, rdepend)
- print >> depends_file, "}"
+ print('"%s" -> "%s" [style=dashed]' % (package, rdepend), file=depends_file)
+ print("}", file=depends_file)
bb.msg.plain("Package dependencies saved to 'package-depends.dot'")
tdepends_file = file('task-depends.dot', 'w' )
- print >> tdepends_file, "digraph depends {"
+ print("digraph depends {", file=tdepends_file)
for task in depgraph["tdepends"]:
(pn, taskname) = task.rsplit(".", 1)
fn = depgraph["pn"][pn]["filename"]
version = depgraph["pn"][pn]["version"]
- print >> tdepends_file, '"%s.%s" [label="%s %s\\n%s\\n%s"]' % (pn, taskname, pn, taskname, version, fn)
+ print('"%s.%s" [label="%s %s\\n%s\\n%s"]' % (pn, taskname, pn, taskname, version, fn), file=tdepends_file)
for dep in depgraph["tdepends"][task]:
- print >> tdepends_file, '"%s" -> "%s"' % (task, dep)
- print >> tdepends_file, "}"
+ print('"%s" -> "%s"' % (task, dep), file=tdepends_file)
+ print("}", file=tdepends_file)
bb.msg.plain("Task dependencies saved to 'task-depends.dot'")
def buildDepgraph( self ):
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index f0690b4f2..c0a8db15a 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -104,13 +104,13 @@ def worker_fire(event, d):
data = "<event>" + pickle.dumps(event) + "</event>"
try:
if os.write(worker_pipe, data) != len (data):
- print "Error sending event to server (short write)"
+ print("Error sending event to server (short write)")
except OSError:
sys.exit(1)
def fire_from_worker(event, d):
if not event.startswith("<event>") or not event.endswith("</event>"):
- print "Error, not an event"
+ print("Error, not an event")
return
event = pickle.loads(event[7:-8])
fire_ui_handlers(event, d)
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 09c83b026..b4d08d6cd 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):
if not line:
break
if not quiet:
- print line,
+ print(line, end=' ')
output += line
status = stdout_handle.close() or 0
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index 533268625..8c91de9db 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -197,7 +197,7 @@ class Git(Fetch):
# Check if we have the rev already
if not os.path.exists(ud.clonedir):
- print "no repo"
+ print("no repo")
self.go(None, ud, d)
if not os.path.exists(ud.clonedir):
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 68e6fdb1d..86c76f4e4 100644
--- a/bitbake/lib/bb/fetch/ssh.py
+++ b/bitbake/lib/bb/fetch/ssh.py
@@ -114,5 +114,5 @@ class SSH(Fetch):
(exitstatus, output) = commands.getstatusoutput(cmd)
if exitstatus != 0:
- print output
+ print(output)
raise FetchError('Unable to fetch %s' % url)
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 788e1dddf..0d90f959d 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -110,7 +110,7 @@ def debug(level, msgdomain, msg, fn = None):
if debug_level[msgdomain] >= level:
bb.event.fire(MsgDebug(msg), None)
if not bb.event._ui_handlers:
- print 'DEBUG: ' + msg
+ print('DEBUG: ' + msg)
def note(level, msgdomain, msg, fn = None):
if not msgdomain:
@@ -119,25 +119,25 @@ def note(level, msgdomain, msg, fn = None):
if level == 1 or verbose or debug_level[msgdomain] >= 1:
bb.event.fire(MsgNote(msg), None)
if not bb.event._ui_handlers:
- print 'NOTE: ' + msg
+ print('NOTE: ' + msg)
def warn(msgdomain, msg, fn = None):
bb.event.fire(MsgWarn(msg), None)
if not bb.event._ui_handlers:
- print 'WARNING: ' + msg
+ print('WARNING: ' + msg)
def error(msgdomain, msg, fn = None):
bb.event.fire(MsgError(msg), None)
if not bb.event._ui_handlers:
- print 'ERROR: ' + msg
+ print('ERROR: ' + msg)
def fatal(msgdomain, msg, fn = None):
bb.event.fire(MsgFatal(msg), None)
if not bb.event._ui_handlers:
- print 'FATAL: ' + msg
+ print('FATAL: ' + msg)
sys.exit(1)
def plain(msg, fn = None):
bb.event.fire(MsgPlain(msg), None)
if not bb.event._ui_handlers:
- print msg
+ print(msg)
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 9881315b9..de1160eb8 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -852,7 +852,7 @@ class RunQueue:
return False
if self.state is runQueueChildProcess:
- print "Child process"
+ print("Child process")
return False
# Loop
@@ -1194,5 +1194,5 @@ class runQueuePipe():
while self.read():
continue
if len(self.queue) > 0:
- print "Warning, worker left partial message"
+ print("Warning, worker left partial message")
os.close(self.fd)
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index e1e514fc9..3844a1e33 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -42,7 +42,7 @@ from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
import inspect, select
if sys.hexversion < 0x020600F0:
- print "Sorry, python 2.6 or later is required for bitbake's XMLRPC mode"
+ print("Sorry, python 2.6 or later is required for bitbake's XMLRPC mode")
sys.exit(1)
class BitBakeServerCommands():
@@ -74,7 +74,7 @@ class BitBakeServerCommands():
Trigger the server to quit
"""
self.server.quit = True
- print "Server (cooker) exitting"
+ print("Server (cooker) exitting")
return
def ping(self):
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py
index 71dd599ed..0dcf45dd5 100644
--- a/bitbake/lib/bb/shell.py
+++ b/bitbake/lib/bb/shell.py
@@ -98,7 +98,7 @@ class BitBakeShellCommands:
def _checkParsed( self ):
if not parsed:
- print "SHELL: This command needs to parse bbfiles..."
+ print("SHELL: This command needs to parse bbfiles...")
self.parse( None )
def _findProvider( self, item ):
@@ -119,28 +119,28 @@ class BitBakeShellCommands:
"""Register a new name for a command"""
new, old = params
if not old in cmds:
- print "ERROR: Command '%s' not known" % old
+ print("ERROR: Command '%s' not known" % old)
else:
cmds[new] = cmds[old]
- print "OK"
+ print("OK")
alias.usage = "<alias> <command>"
def buffer( self, params ):
"""Dump specified output buffer"""
index = params[0]
- print self._shell.myout.buffer( int( index ) )
+ print(self._shell.myout.buffer( int( index ) ))
buffer.usage = "<index>"
def buffers( self, params ):
"""Show the available output buffers"""
commands = self._shell.myout.bufferedCommands()
if not commands:
- print "SHELL: No buffered commands available yet. Start doing something."
+ print("SHELL: No buffered commands available yet. Start doing something.")
else:
- print "="*35, "Available Output Buffers", "="*27
+ print("="*35, "Available Output Buffers", "="*27)
for index, cmd in enumerate( commands ):
- print "| %s %s" % ( str( index ).ljust( 3 ), cmd )
- print "="*88
+ print("| %s %s" % ( str( index ).ljust( 3 ), cmd ))
+ print("="*88)
def build( self, params, cmd = "build" ):
"""Build a providee"""
@@ -149,7 +149,7 @@ class BitBakeShellCommands:
self._checkParsed()
names = globfilter( cooker.status.pkg_pn, globexpr )
if len( names ) == 0: names = [ globexpr ]
- print "SHELL: Building %s" % ' '.join( names )
+ print("SHELL: Building %s" % ' '.join( names ))
td = taskdata.TaskData(cooker.configuration.abort)
localdata = data.createCopy(cooker.configuration.data)
@@ -174,16 +174,16 @@ class BitBakeShellCommands:
rq.execute_runqueue()
except Providers.NoProvider:
- print "ERROR: No Provider"
+ print("ERROR: No Provider")
last_exception = Providers.NoProvider
except runqueue.TaskFailure, fnids:
for fnid in fnids:
- print "ERROR: '%s' failed" % td.fn_index[fnid]
+ print("ERROR: '%s' failed" % td.fn_index[fnid])
last_exception = runqueue.TaskFailure
except build.EventException, e:
- print "ERROR: Couldn't build '%s'" % names
+ print("ERROR: Couldn't build '%s'" % names)
last_exception = e
@@ -216,7 +216,7 @@ class BitBakeShellCommands:
if bbfile is not None:
os.system( "%s %s" % ( os.environ.get( "EDITOR", "vi" ), bbfile ) )
else:
- print "ERROR: Nothing provides '%s'" % name
+ print("ERROR: Nothing provides '%s'" % name)
edit.usage = "<providee>"
def environment( self, params ):
@@ -239,14 +239,14 @@ class BitBakeShellCommands:
global last_exception
name = params[0]
bf = completeFilePath( name )
- print "SHELL: Calling '%s' on '%s'" % ( cmd, bf )
+ print("SHELL: Calling '%s' on '%s'" % ( cmd, bf ))
try:
cooker.buildFile(bf, cmd)
except parse.ParseError:
- print "ERROR: Unable to open or parse '%s'" % bf
+ print("ERROR: Unable to open or parse '%s'" % bf)
except build.EventException, e:
- print "ERROR: Couldn't build '%s'" % name
+ print("ERROR: Couldn't build '%s'" % name)
last_exception = e
fileBuild.usage = "<bbfile>"
@@ -270,62 +270,62 @@ class BitBakeShellCommands:
def fileReparse( self, params ):
"""(re)Parse a bb file"""
bbfile = params[0]
- print "SHELL: Parsing '%s'" % bbfile
+ print("SHELL: Parsing '%s'" % bbfile)
parse.update_mtime( bbfile )
cooker.bb_cache.cacheValidUpdate(bbfile)
fromCache = cooker.bb_cache.loadData(bbfile, cooker.configuration.data, cooker.status)
cooker.bb_cache.sync()
if False: #fromCache:
- print "SHELL: File has not been updated, not reparsing"
+ print("SHELL: File has not been updated, not reparsing")
else:
- print "SHELL: Parsed"
+ print("SHELL: Parsed")
fileReparse.usage = "<bbfile>"
def abort( self, params ):
"""Toggle abort task execution flag (see bitbake -k)"""
cooker.configuration.abort = not cooker.configuration.abort
- print "SHELL: Abort Flag is now '%s'" % repr( cooker.configuration.abort )
+ print("SHELL: Abort Flag is now '%s'" % repr( cooker.configuration.abort ))
def force( self, params ):
"""Toggle force task execution flag (see bitbake -f)"""
cooker.configuration.force = not cooker.configuration.force
- print "SHELL: Force Flag is now '%s'" % repr( cooker.configuration.force )
+ print("SHELL: Force Flag is now '%s'" % repr( cooker.configuration.force ))
def help( self, params ):
"""Show a comprehensive list of commands and their purpose"""
- print "="*30, "Available Commands", "="*30
+ print("="*30, "Available Commands", "="*30)
for cmd in sorted(cmds):
function, numparams, usage, helptext = cmds[cmd]
- print "| %s | %s" % (usage.ljust(30), helptext)
- print "="*78
+ print("| %s | %s" % (usage.ljust(30), helptext))
+ print("="*78)
def lastError( self, params ):
"""Show the reason or log that was produced by the last BitBake event exception"""
if last_exception is None:
- print "SHELL: No Errors yet (Phew)..."
+ print("SHELL: No Errors yet (Phew)...")
else:
reason, event = last_exception.args
- print "SHELL: Reason for the last error: '%s'" % reason
+ print("SHELL: Reason for the last error: '%s'" % reason)
if ':' in reason:
msg, filename = reason.split( ':' )
filename = filename.strip()
- print "SHELL: Dumping log file for last error:"
+ print("SHELL: Dumping log file for last error:")
try:
- print open( filename ).read()
+ print(open( filename ).read())
except IOError:
- print "ERROR: Couldn't open '%s'" % filename
+ print("ERROR: Couldn't open '%s'" % filename)
def match( self, params ):
"""Dump all files or providers matching a glob expression"""
what, globexpr = params
if what == "files":
self._checkParsed()
- for key in globfilter( cooker.status.pkg_fn, globexpr ): print key
+ for key in globfilter( cooker.status.pkg_fn, globexpr ): print(key)
elif what == "providers":
self._checkParsed()
- for key in globfilter( cooker.status.pkg_pn, globexpr ): print key
+ for key in globfilter( cooker.status.pkg_pn, globexpr ): print(key)
else:
- print "Usage: match %s" % self.print_.usage
+ print("Usage: match %s" % self.print_.usage)
match.usage = "<files|providers> <glob>"
def new( self, params ):
@@ -335,15 +335,15 @@ class BitBakeShellCommands:
fulldirname = "%s/%s" % ( packages, dirname )
if not os.path.exists( fulldirname ):
- print "SHELL: Creating '%s'" % fulldirname
+ print("SHELL: Creating '%s'" % fulldirname)
os.mkdir( fulldirname )
if os.path.exists( fulldirname ) and os.path.isdir( fulldirname ):
if os.path.exists( "%s/%s" % ( fulldirname, filename ) ):
- print "SHELL: ERROR: %s/%s already exists" % ( fulldirname, filename )
+ print("SHELL: ERROR: %s/%s already exists" % ( fulldirname, filename ))
return False
- print "SHELL: Creating '%s/%s'" % ( fulldirname, filename )
+ print("SHELL: Creating '%s/%s'" % ( fulldirname, filename ))
newpackage = open( "%s/%s" % ( fulldirname, filename ), "w" )
- print >>newpackage, """DESCRIPTION = ""
+ print("""DESCRIPTION = ""
SECTION = ""
AUTHOR = ""
HOMEPAGE = ""
@@ -370,7 +370,7 @@ SRC_URI = ""
#do_install() {
#
#}
-"""
+""", file=newpackage)
newpackage.close()
os.system( "%s %s/%s" % ( os.environ.get( "EDITOR" ), fulldirname, filename ) )
new.usage = "<directory> <filename>"
@@ -390,14 +390,14 @@ SRC_URI = ""
def pasteLog( self, params ):
"""Send the last event exception error log (if there is one) to http://rafb.net/paste"""
if last_exception is None:
- print "SHELL: No Errors yet (Phew)..."
+ print("SHELL: No Errors yet (Phew)...")
else:
reason, event = last_exception.args
- print "SHELL: Reason for the last error: '%s'" % reason
+ print("SHELL: Reason for the last error: '%s'" % reason)
if ':' in reason:
msg, filename = reason.split( ':' )
filename = filename.strip()
- print "SHELL: Pasting log file to pastebin..."
+ print("SHELL: Pasting log file to pastebin...")
file = open( filename ).read()
sendToPastebin( "contents of " + filename, file )
@@ -419,23 +419,23 @@ SRC_URI = ""
cooker.buildDepgraph()
global parsed
parsed = True
- print
+ print()
def reparse( self, params ):
"""(re)Parse a providee's bb file"""
bbfile = self._findProvider( params[0] )
if bbfile is not None:
- print "SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] )
+ print("SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] ))
self.fileReparse( [ bbfile ] )
else:
- print "ERROR: Nothing provides '%s'" % params[0]
+ print("ERROR: Nothing provides '%s'" % params[0])
reparse.usage = "<providee>"
def getvar( self, params ):
"""Dump the contents of an outer BitBake environment variable"""
var = params[0]
value = data.getVar( var, cooker.configuration.data, 1 )
- print value
+ print(value)
getvar.usage = "<variable>"
def peek( self, params ):
@@ -445,9 +445,9 @@ SRC_URI = ""
if bbfile is not None:
the_data = cooker.bb_cache.loadDataFull(bbfile, cooker.configuration.data)
value = the_data.getVar( var, 1 )
- print value
+ print(value)
else:
- print "ERROR: Nothing provides '%s'" % name
+ print("ERROR: Nothing provides '%s'" % name)
peek.usage = "<providee> <variable>"
def poke( self, params ):
@@ -455,7 +455,7 @@ SRC_URI = ""
name, var, value = params
bbfile = self._findProvider( name )
if bbfile is not None:
- print "ERROR: Sorry, this functionality is currently broken"
+ print("ERROR: Sorry, this functionality is currently broken")
#d = cooker.pkgdata[bbfile]
#data.setVar( var, value, d )
@@ -463,7 +463,7 @@ SRC_URI = ""
#cooker.pkgdata.setDirty(bbfile, d)
#print "OK"
else:
- print "ERROR: Nothing provides '%s'" % name
+ print("ERROR: Nothing provides '%s'" % name)
poke.usage = "<providee> <variable> <value>"
def print_( self, params ):
@@ -471,12 +471,12 @@ SRC_URI = ""
what = params[0]
if what == "files":
self._checkParsed()
- for key in cooker.status.pkg_fn: print key
+ for key in cooker.status.pkg_fn: print(key)
elif what == "providers":
self._checkParsed()
- for key in cooker.status.providers: print key
+ for key in cooker.status.providers: print(key)
else:
- print "Usage: print %s" % self.print_.usage
+ print("Usage: print %s" % self.print_.usage)
print_.usage = "<files|providers>"
def python( self, params ):
@@ -496,7 +496,7 @@ SRC_URI = ""
"""Set an outer BitBake environment variable"""
var, value = params
data.setVar( var, value, cooker.configuration.data )
- print "OK"
+ print("OK")
setVar.usage = "<variable> <value>"
def rebuild( self, params ):
@@ -508,7 +508,7 @@ SRC_URI = ""
def shell( self, params ):
"""Execute a shell command and dump the output"""
if params != "":
- print commands.getoutput( " ".join( params ) )
+ print(commands.getoutput( " ".join( params ) ))
shell.usage = "<...>"
def stage( self, params ):
@@ -518,17 +518,17 @@ SRC_URI = ""
def status( self, params ):
"""<just for testing>"""
- print "-" * 78
- print "building list = '%s'" % cooker.building_list
- print "build path = '%s'" % cooker.build_path
- print "consider_msgs_cache = '%s'" % cooker.consider_msgs_cache
- print "build stats = '%s'" % cooker.stats
- if last_exception is not None: print "last_exception = '%s'" % repr( last_exception.args )
- print "memory output contents = '%s'" % self._shell.myout._buffer
+ print("-" * 78)
+ print("building list = '%s'" % cooker.building_list)
+ print("build path = '%s'" % cooker.build_path)
+ print("consider_msgs_cache = '%s'" % cooker.consider_msgs_cache)
+ print("build stats = '%s'" % cooker.stats)
+ if last_exception is not None: print("last_exception = '%s'" % repr( last_exception.args ))
+ print("memory output contents = '%s'" % self._shell.myout._buffer)
def test( self, params ):
"""<just for testing>"""
- print "testCommand called with '%s'" % params
+ print("testCommand called with '%s'" % params)
def unpack( self, params ):
"""Execute 'unpack' on a providee"""
@@ -553,12 +553,12 @@ SRC_URI = ""
try:
providers = cooker.status.providers[item]
except KeyError:
- print "SHELL: ERROR: Nothing provides", preferred
+ print("SHELL: ERROR: Nothing provides", preferred)
else:
for provider in providers:
if provider == pf: provider = " (***) %s" % provider
else: provider = " %s" % provider
- print provider
+ print(provider)
which.usage = "<providee>"
##########################################################################
@@ -594,9 +594,9 @@ def sendToPastebin( desc, content ):
if response.status == 302:
location = response.getheader( "location" ) or "unknown"
- print "SHELL: Pasted to http://%s%s" % ( host, location )
+ print("SHELL: Pasted to http://%s%s" % ( host, location ))
else:
- print "ERROR: %s %s" % ( response.status, response.reason )
+ print("ERROR: %s %s" % ( response.status, response.reason ))
def completer( text, state ):
"""Return a possible readline completion"""
@@ -718,7 +718,7 @@ class BitBakeShell:
except IOError:
pass # It doesn't exist yet.
- print __credits__
+ print(__credits__)
def cleanup( self ):
"""Write readline history and clean up resources"""
@@ -726,7 +726,7 @@ class BitBakeShell:
try:
readline.write_history_file( self.historyfilename )
except:
- print "SHELL: Unable to save command history"
+ print("SHELL: Unable to save command history")
def registerCommand( self, command, function, numparams = 0, usage = "", helptext = "" ):
"""Register a command"""
@@ -740,11 +740,11 @@ class BitBakeShell:
try:
function, numparams, usage, helptext = cmds[command]
except KeyError:
- print "SHELL: ERROR: '%s' command is not a valid command." % command
+ print("SHELL: ERROR: '%s' command is not a valid command." % command)
self.myout.removeLast()
else:
if (numparams != -1) and (not len( params ) == numparams):
- print "Usage: '%s'" % usage
+ print("Usage: '%s'" % usage)
return
result = function( self.commands, params )
@@ -759,7 +759,7 @@ class BitBakeShell:
if not cmdline:
continue
if "|" in cmdline:
- print "ERROR: '|' in startup file is not allowed. Ignoring line"
+ print("ERROR: '|' in startup file is not allowed. Ignoring line")
continue
self.commandQ.put( cmdline.strip() )
@@ -801,10 +801,10 @@ class BitBakeShell:
sys.stdout.write( pipe.fromchild.read() )
#
except EOFError:
- print
+ print()
return
except KeyboardInterrupt:
- print
+ print()
##########################################################################
# Start function - called from the BitBake command line utility
@@ -819,4 +819,4 @@ def start( aCooker ):
bbshell.cleanup()
if __name__ == "__main__":
- print "SHELL: Sorry, this program should only be called by BitBake."
+ 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 f5a15329d..37a62f189 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):
# pull it out.
# TODO: Better to stat a file?
(_ , date, revision) = identifier.split ("-")
- print date
+ print(date)
year = int (date[0:4])
month = int (date[4:6])
@@ -386,7 +386,7 @@ class BuildManager (gobject.GObject):
server.runCommand(["buildTargets", [conf.image], "rootfs"])
except Exception, e:
- print e
+ print(e)
class BuildManagerTreeView (gtk.TreeView):
""" 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 c596cad5c..e386e3495 100644
--- a/bitbake/lib/bb/ui/depexp.py
+++ b/bitbake/lib/bb/ui/depexp.py
@@ -201,14 +201,14 @@ def init(server, eventHandler):
try:
cmdline = server.runCommand(["getCmdLineAction"])
if not cmdline or cmdline[0] != "generateDotGraph":
- print "This UI is only compatible with the -g option"
+ print("This UI is only compatible with the -g option")
return
ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]])
if ret != True:
- print "Couldn't run command! %s" % ret
+ print("Couldn't run command! %s" % ret)
return
except xmlrpclib.Fault, x:
- print "XMLRPC Fault getting commandline:\n %s" % x
+ print("XMLRPC Fault getting commandline:\n %s" % x)
return
shutdown = 0
@@ -233,8 +233,8 @@ def init(server, eventHandler):
x = event.sofar
y = event.total
if x == y:
- print("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors."
- % ( event.cached, event.parsed, event.skipped, event.masked, event.errors))
+ print(("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors."
+ % ( event.cached, event.parsed, event.skipped, event.masked, event.errors)))
pbar.hide()
gtk.gdk.threads_enter()
pbar.progress.set_fraction(float(x)/float(y))
@@ -250,7 +250,7 @@ def init(server, eventHandler):
if isinstance(event, bb.command.CookerCommandCompleted):
continue
if isinstance(event, bb.command.CookerCommandFailed):
- print "Command execution failed: %s" % event.error
+ print("Command execution failed: %s" % event.error)
break
if isinstance(event, bb.cooker.CookerExit):
break
@@ -259,13 +259,13 @@ def init(server, eventHandler):
except KeyboardInterrupt:
if shutdown == 2:
- print "\nThird Keyboard Interrupt, exit.\n"
+ print("\nThird Keyboard Interrupt, exit.\n")
break
if shutdown == 1:
- print "\nSecond Keyboard Interrupt, stopping...\n"
+ print("\nSecond Keyboard Interrupt, stopping...\n")
server.runCommand(["stateStop"])
if shutdown == 0:
- print "\nKeyboard Interrupt, closing down...\n"
+ print("\nKeyboard Interrupt, closing down...\n")
server.runCommand(["stateShutdown"])
shutdown = shutdown + 1
pass
diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py
index bcba38be9..7a3427f71 100644
--- a/bitbake/lib/bb/ui/goggle.py
+++ b/bitbake/lib/bb/ui/goggle.py
@@ -55,15 +55,15 @@ def init (server, eventHandler):
window.cur_build_tv.set_model (running_build.model)
try:
cmdline = server.runCommand(["getCmdLineAction"])
- print cmdline
+ print(cmdline)
if not cmdline:
return 1
ret = server.runCommand(cmdline)
if ret != True:
- print "Couldn't get default commandline! %s" % ret
+ print("Couldn't get default commandline! %s" % ret)
return 1
except xmlrpclib.Fault, x:
- print "XMLRPC Fault getting commandline:\n %s" % x
+ print("XMLRPC Fault getting commandline:\n %s" % x)
return 1
# 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 3261792df..dba9530ef 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -44,10 +44,10 @@ def init(server, eventHandler):
return 1
ret = server.runCommand(cmdline)
if ret != True:
- print "Couldn't get default commandline! %s" % ret
+ print("Couldn't get default commandline! %s" % ret)
return 1
except xmlrpclib.Fault, x:
- print "XMLRPC Fault getting commandline:\n %s" % x
+ print("XMLRPC Fault getting commandline:\n %s" % x)
return 1
shutdown = 0
@@ -65,39 +65,39 @@ def init(server, eventHandler):
if shutdown and helper.needUpdate:
activetasks, failedtasks = helper.getTasks()
if activetasks:
- print "Waiting for %s active tasks to finish:" % len(activetasks)
+ print("Waiting for %s active tasks to finish:" % len(activetasks))
tasknum = 1
for task in activetasks:
- print "%s: %s (pid %s)" % (tasknum, activetasks[task]["title"], task)
+ print("%s: %s (pid %s)" % (tasknum, activetasks[task]["title"], task))
tasknum = tasknum + 1
if isinstance(event, bb.msg.MsgPlain):
- print event._message
+ print(event._message)
continue
if isinstance(event, bb.msg.MsgDebug):
- print 'DEBUG: ' + event._message
+ print('DEBUG: ' + event._message)
continue
if isinstance(event, bb.msg.MsgNote):
- print 'NOTE: ' + event._message
+ print('NOTE: ' + event._message)
continue
if isinstance(event, bb.msg.MsgWarn):
- print 'WARNING: ' + event._message
+ print('WARNING: ' + event._message)
continue
if isinstance(event, bb.msg.MsgError):
return_value = 1
- print 'ERROR: ' + event._message
+ print('ERROR: ' + event._message)
continue
if isinstance(event, bb.msg.MsgFatal):
return_value = 1
- print 'FATAL: ' + event._message
+ print('FATAL: ' + event._message)
break
if isinstance(event, bb.build.TaskFailed):
return_value = 1
logfile = event.logfile
if logfile:
- print "ERROR: Logfile of failure stored in: %s" % logfile
+ print("ERROR: Logfile of failure stored in: %s" % logfile)
if 1 or includelogs:
- print "Log data follows:"
+ print("Log data follows:")
f = open(logfile, "r")
lines = []
while True:
@@ -110,13 +110,13 @@ def init(server, eventHandler):
if len(lines) > int(loglines):
lines.pop(0)
else:
- print '| %s' % l
+ print('| %s' % l)
f.close()
if lines:
for line in lines:
- print line
+ print(line)
if isinstance(event, bb.build.TaskBase):
- print "NOTE: %s" % event._message
+ print("NOTE: %s" % event._message)
continue
if isinstance(event, bb.event.ParseProgress):
x = event.sofar
@@ -132,8 +132,8 @@ def init(server, eventHandler):
sys.stdout.write("done.")
sys.stdout.flush()
if x == y:
- print("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
- % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))
+ print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
+ % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
continue
if isinstance(event, bb.command.CookerCommandCompleted):
@@ -143,7 +143,7 @@ def init(server, eventHandler):
continue
if isinstance(event, bb.command.CookerCommandFailed):
return_value = 1
- print "Command execution failed: %s" % event.error
+ print("Command execution failed: %s" % event.error)
break
if isinstance(event, bb.cooker.CookerExit):
break
@@ -165,17 +165,17 @@ def init(server, eventHandler):
continue
if isinstance(event, bb.event.RecipeParsed):
continue
- print "Unknown Event: %s" % event
+ print("Unknown Event: %s" % event)
except KeyboardInterrupt:
if shutdown == 2:
- print "\nThird Keyboard Interrupt, exit.\n"
+ print("\nThird Keyboard Interrupt, exit.\n")
break
if shutdown == 1:
- print "\nSecond Keyboard Interrupt, stopping...\n"
+ print("\nSecond Keyboard Interrupt, stopping...\n")
server.runCommand(["stateStop"])
if shutdown == 0:
- print "\nKeyboard Interrupt, closing down...\n"
+ print("\nKeyboard Interrupt, closing down...\n")
server.runCommand(["stateShutdown"])
shutdown = shutdown + 1
pass
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py
index 0eb1cf013..89e67900b 100644
--- a/bitbake/lib/bb/ui/ncurses.py
+++ b/bitbake/lib/bb/ui/ncurses.py
@@ -232,10 +232,10 @@ class NCursesUI:
return
ret = server.runCommand(cmdline)
if ret != True:
- print "Couldn't get default commandlind! %s" % ret
+ print("Couldn't get default commandlind! %s" % ret)
return
except xmlrpclib.Fault, x:
- print "XMLRPC Fault getting commandline:\n %s" % x
+ print("XMLRPC Fault getting commandline:\n %s" % x)
return
exitflag = False
@@ -324,7 +324,7 @@ class NCursesUI:
def init(server, eventHandler):
if not os.isatty(sys.stdout.fileno()):
- print "FATAL: Unable to run 'ncurses' UI without a TTY."
+ print("FATAL: Unable to run 'ncurses' UI without a TTY.")
return
ui = NCursesUI()
try:
diff --git a/bitbake/lib/bb/ui/puccho.py b/bitbake/lib/bb/ui/puccho.py
index dfcb0f765..7dffa5c3b 100644
--- a/bitbake/lib/bb/ui/puccho.py
+++ b/bitbake/lib/bb/ui/puccho.py
@@ -110,7 +110,7 @@ class MetaDataLoader(gobject.GObject):
except Exception, e:
gobject.idle_add (MetaDataLoader.emit_error_signal, self.loader,
"Unable to download repository metadata")
- print e
+ print(e)
def try_fetch_from_url (self, url):
# Try and download the metadata. Firing a signal if successful
@@ -326,8 +326,8 @@ class MainWindow (gtk.Window):
conf = None
if (response_id == BuildSetupDialog.RESPONSE_BUILD):
dialog.update_configuration()
- print dialog.configuration.machine, dialog.configuration.distro, \
- dialog.configuration.image
+ print(dialog.configuration.machine, dialog.configuration.distro, \
+ dialog.configuration.image)
conf = dialog.configuration
dialog.destroy()
@@ -383,11 +383,11 @@ def running_build_succeeded_cb (running_build, manager):
# BuildManager. It can then hook onto the signals directly and drive
# interesting things it cares about.
manager.notify_build_succeeded ()
- print "build succeeded"
+ print("build succeeded")
def running_build_failed_cb (running_build, manager):
# As above
- print "build failed"
+ print("build failed")
manager.notify_build_failed ()
def init (server, eventHandler):
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 5c6aafd1f..7446be875 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):
if not sstat:
sstat = os.lstat(src)
except Exception, e:
- print "movefile: Stating source file failed...", e
+ print("movefile: Stating source file failed...", e)
return None
destexists = 1
@@ -590,7 +590,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
os.unlink(src)
return os.lstat(dest)
except Exception, e:
- print "movefile: failed to properly create symlink:", dest, "->", target, e
+ print("movefile: failed to properly create symlink:", dest, "->", target, e)
return None
renamefailed = 1
@@ -601,7 +601,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
except Exception, e:
if e[0] != errno.EXDEV:
# Some random error.
- print "movefile: Failed to move", src, "to", dest, e
+ print("movefile: Failed to move", src, "to", dest, e)
return None
# Invalid cross-device-link 'bind' mounted or actually Cross-Device
@@ -613,13 +613,13 @@ def movefile(src, dest, newmtime = None, sstat = None):
os.rename(dest + "#new", dest)
didcopy = 1
except Exception, e:
- print 'movefile: copy', src, '->', dest, 'failed.', e
+ print('movefile: copy', src, '->', dest, 'failed.', e)
return None
else:
#we don't yet handle special, so we need to fall back to /bin/mv
a = getstatusoutput("/bin/mv -f " + "'" + src + "' '" + dest + "'")
if a[0] != 0:
- print "movefile: Failed to move special file:" + src + "' to '" + dest + "'", a
+ print("movefile: Failed to move special file:" + src + "' to '" + dest + "'", a)
return None # failure
try:
if didcopy:
@@ -627,7 +627,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
os.unlink(src)
except Exception, e:
- print "movefile: Failed to chown/chmod/unlink", dest, e
+ print("movefile: Failed to chown/chmod/unlink", dest, e)
return None
if newmtime:
@@ -648,7 +648,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
if not sstat:
sstat = os.lstat(src)
except Exception, e:
- print "copyfile: Stating source file failed...", e
+ print("copyfile: Stating source file failed...", e)
return False
destexists = 1
@@ -675,7 +675,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
#os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
return os.lstat(dest)
except Exception, e:
- print "copyfile: failed to properly create symlink:", dest, "->", target, e
+ print("copyfile: failed to properly create symlink:", dest, "->", target, e)
return False
if stat.S_ISREG(sstat[stat.ST_MODE]):
@@ -683,19 +683,19 @@ def copyfile(src, dest, newmtime = None, sstat = None):
shutil.copyfile(src, dest + "#new")
os.rename(dest + "#new", dest)
except Exception, e:
- print 'copyfile: copy', src, '->', dest, 'failed.', e
+ print('copyfile: copy', src, '->', dest, 'failed.', e)
return False
else:
#we don't yet handle special, so we need to fall back to /bin/mv
a = getstatusoutput("/bin/cp -f " + "'" + src + "' '" + dest + "'")
if a[0] != 0:
- print "copyfile: Failed to copy special file:" + src + "' to '" + dest + "'", a
+ print("copyfile: Failed to copy special file:" + src + "' to '" + dest + "'", a)
return False # failure
try:
os.lchown(dest, sstat[stat.ST_UID], sstat[stat.ST_GID])
os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
except Exception, e:
- print "copyfile: Failed to chown/chmod/unlink", dest, e
+ print("copyfile: Failed to chown/chmod/unlink", dest, e)
return False
if newmtime: