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