Apply some 2to3 transforms that don't cause issues in 2.6
(Bitbake rev: d39ab776e7ceaefc8361150151cf0892dcb70d9c) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
5b216c8000
commit
1180bab54e
|
@ -140,7 +140,7 @@ def exec_func(func, d, dirs = None):
|
|||
so = os.popen("tee \"%s\"" % logfile, "w")
|
||||
else:
|
||||
so = file(logfile, 'w')
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
bb.msg.error(bb.msg.domain.Build, "opening log file: %s" % e)
|
||||
pass
|
||||
|
||||
|
@ -285,7 +285,7 @@ def exec_task(task, d):
|
|||
event.fire(TaskStarted(task, localdata), localdata)
|
||||
exec_func(task, localdata)
|
||||
event.fire(TaskSucceeded(task, localdata), localdata)
|
||||
except FuncFailed, message:
|
||||
except FuncFailed as message:
|
||||
# Try to extract the optional logfile
|
||||
try:
|
||||
(msg, logfile) = message
|
||||
|
|
|
@ -61,7 +61,7 @@ class Cache:
|
|||
return
|
||||
|
||||
self.has_cache = True
|
||||
self.cachefile = os.path.join(self.cachedir,"bb_cache.dat")
|
||||
self.cachefile = os.path.join(self.cachedir, "bb_cache.dat")
|
||||
|
||||
bb.msg.debug(1, bb.msg.domain.Cache, "Using cache in '%s'" % self.cachedir)
|
||||
try:
|
||||
|
@ -82,9 +82,9 @@ class Cache:
|
|||
p = pickle.Unpickler(file(self.cachefile, "rb"))
|
||||
self.depends_cache, version_data = p.load()
|
||||
if version_data['CACHE_VER'] != __cache_version__:
|
||||
raise ValueError, 'Cache Version Mismatch'
|
||||
raise ValueError('Cache Version Mismatch')
|
||||
if version_data['BITBAKE_VER'] != bb.__version__:
|
||||
raise ValueError, 'Bitbake Version Mismatch'
|
||||
raise ValueError('Bitbake Version Mismatch')
|
||||
except EOFError:
|
||||
bb.msg.note(1, bb.msg.domain.Cache, "Truncated cache found, rebuilding...")
|
||||
self.depends_cache = {}
|
||||
|
@ -446,7 +446,7 @@ class Cache:
|
|||
self.getVar('__BB_DONT_CACHE', file_name, True)
|
||||
self.getVar('__VARIANTS', file_name, True)
|
||||
|
||||
def load_bbfile( self, bbfile , config):
|
||||
def load_bbfile( self, bbfile, config):
|
||||
"""
|
||||
Load and parse one .bb build file
|
||||
Return the data and whether parsing resulted in the file being skipped
|
||||
|
|
|
@ -54,8 +54,8 @@ def createDaemon(function, logfile):
|
|||
# and inherits the parent's process group ID. This step is required
|
||||
# to insure that the next call to os.setsid is successful.
|
||||
pid = os.fork()
|
||||
except OSError, e:
|
||||
raise Exception, "%s [%d]" % (e.strerror, e.errno)
|
||||
except OSError as e:
|
||||
raise Exception("%s [%d]" % (e.strerror, e.errno))
|
||||
|
||||
if (pid == 0): # The first child.
|
||||
# To become the session leader of this new session and the process group
|
||||
|
@ -102,8 +102,8 @@ def createDaemon(function, logfile):
|
|||
# longer a session leader, preventing the daemon from ever acquiring
|
||||
# a controlling terminal.
|
||||
pid = os.fork() # Fork a second child.
|
||||
except OSError, e:
|
||||
raise Exception, "%s [%d]" % (e.strerror, e.errno)
|
||||
except OSError as e:
|
||||
raise Exception("%s [%d]" % (e.strerror, e.errno))
|
||||
|
||||
if (pid == 0): # The second child.
|
||||
# We probably don't want the file mode creation mask inherited from
|
||||
|
|
|
@ -193,7 +193,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
|
|||
if all:
|
||||
o.write('# %s=%s\n' % (var, oval))
|
||||
|
||||
if type(val) is not types.StringType:
|
||||
if not isinstance(val, types.StringType):
|
||||
return 0
|
||||
|
||||
if (var.find("-") != -1 or var.find(".") != -1 or var.find('{') != -1 or var.find('}') != -1 or var.find('+') != -1) and not all:
|
||||
|
|
|
@ -66,10 +66,10 @@ class DataSmart:
|
|||
code = match.group()[3:-1]
|
||||
codeobj = compile(code.strip(), varname or "<expansion>", "eval")
|
||||
s = utils.better_eval(codeobj, {"d": self})
|
||||
if type(s) == types.IntType: s = str(s)
|
||||
if isinstance(s, types.IntType): s = str(s)
|
||||
return s
|
||||
|
||||
if type(s) is not types.StringType: # sanity check
|
||||
if not isinstance(s, types.StringType): # sanity check
|
||||
return s
|
||||
|
||||
if varname and varname in self.expand_cache:
|
||||
|
@ -81,7 +81,7 @@ class DataSmart:
|
|||
s = __expand_var_regexp__.sub(var_sub, s)
|
||||
s = __expand_python_regexp__.sub(python_sub, s)
|
||||
if s == olds: break
|
||||
if type(s) is not types.StringType: # sanity check
|
||||
if not isinstance(s, types.StringType): # sanity check
|
||||
bb.msg.error(bb.msg.domain.Data, 'expansion of %s returned non-string %s' % (olds, s))
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
|
@ -118,7 +118,7 @@ class DataSmart:
|
|||
l = len(o)+1
|
||||
|
||||
# see if one should even try
|
||||
if not self._seen_overrides.has_key(o):
|
||||
if o not in self._seen_overrides:
|
||||
continue
|
||||
|
||||
vars = self._seen_overrides[o]
|
||||
|
@ -130,7 +130,7 @@ class DataSmart:
|
|||
bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar")
|
||||
|
||||
# now on to the appends and prepends
|
||||
if self._special_values.has_key("_append"):
|
||||
if "_append" in self._special_values:
|
||||
appends = self._special_values['_append'] or []
|
||||
for append in appends:
|
||||
for (a, o) in self.getVarFlag(append, '_append') or []:
|
||||
|
@ -145,7 +145,7 @@ class DataSmart:
|
|||
self.setVar(append, sval)
|
||||
|
||||
|
||||
if self._special_values.has_key("_prepend"):
|
||||
if "_prepend" in self._special_values:
|
||||
prepends = self._special_values['_prepend'] or []
|
||||
|
||||
for prepend in prepends:
|
||||
|
@ -215,7 +215,7 @@ class DataSmart:
|
|||
# more cookies for the cookie monster
|
||||
if '_' in var:
|
||||
override = var[var.rfind('_')+1:]
|
||||
if not self._seen_overrides.has_key(override):
|
||||
if override not in self._seen_overrides:
|
||||
self._seen_overrides[override] = set()
|
||||
self._seen_overrides[override].add( var )
|
||||
|
||||
|
@ -246,7 +246,7 @@ class DataSmart:
|
|||
dest.extend(src)
|
||||
self.setVarFlag(newkey, i, dest)
|
||||
|
||||
if self._special_values.has_key(i) and key in self._special_values[i]:
|
||||
if i in self._special_values and key in self._special_values[i]:
|
||||
self._special_values[i].remove(key)
|
||||
self._special_values[i].add(newkey)
|
||||
|
||||
|
|
|
@ -139,8 +139,8 @@ class Cvs(Fetch):
|
|||
bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory")
|
||||
pkg = data.expand('${PN}', d)
|
||||
pkgdir = os.path.join(data.expand('${CVSDIR}', localdata), pkg)
|
||||
moddir = os.path.join(pkgdir,localdir)
|
||||
if os.access(os.path.join(moddir,'CVS'), os.R_OK):
|
||||
moddir = os.path.join(pkgdir, localdir)
|
||||
if os.access(os.path.join(moddir, 'CVS'), os.R_OK):
|
||||
bb.msg.note(1, bb.msg.domain.Fetcher, "Update " + loc)
|
||||
# update sources there
|
||||
os.chdir(moddir)
|
||||
|
|
|
@ -35,15 +35,15 @@ class Perforce(Fetch):
|
|||
def supports(self, url, ud, d):
|
||||
return ud.type in ['p4']
|
||||
|
||||
def doparse(url,d):
|
||||
def doparse(url, d):
|
||||
parm = {}
|
||||
path = url.split("://")[1]
|
||||
delim = path.find("@");
|
||||
if delim != -1:
|
||||
(user,pswd,host,port) = path.split('@')[0].split(":")
|
||||
(user, pswd, host, port) = path.split('@')[0].split(":")
|
||||
path = path.split('@')[1]
|
||||
else:
|
||||
(host,port) = data.getVar('P4PORT', d).split(':')
|
||||
(host, port) = data.getVar('P4PORT', d).split(':')
|
||||
user = ""
|
||||
pswd = ""
|
||||
|
||||
|
@ -53,19 +53,19 @@ class Perforce(Fetch):
|
|||
plist = path.split(';')
|
||||
for item in plist:
|
||||
if item.count('='):
|
||||
(key,value) = item.split('=')
|
||||
(key, value) = item.split('=')
|
||||
keys.append(key)
|
||||
values.append(value)
|
||||
|
||||
parm = dict(zip(keys,values))
|
||||
parm = dict(zip(keys, values))
|
||||
path = "//" + path.split(';')[0]
|
||||
host += ":%s" % (port)
|
||||
parm["cset"] = Perforce.getcset(d, path, host, user, pswd, parm)
|
||||
|
||||
return host,path,user,pswd,parm
|
||||
return host, path, user, pswd, parm
|
||||
doparse = staticmethod(doparse)
|
||||
|
||||
def getcset(d, depot,host,user,pswd,parm):
|
||||
def getcset(d, depot, host, user, pswd, parm):
|
||||
p4opt = ""
|
||||
if "cset" in parm:
|
||||
return parm["cset"];
|
||||
|
@ -97,7 +97,7 @@ class Perforce(Fetch):
|
|||
|
||||
def localpath(self, url, ud, d):
|
||||
|
||||
(host,path,user,pswd,parm) = Perforce.doparse(url,d)
|
||||
(host, path, user, pswd, parm) = Perforce.doparse(url, d)
|
||||
|
||||
# If a label is specified, we use that as our filename
|
||||
|
||||
|
@ -115,7 +115,7 @@ class Perforce(Fetch):
|
|||
|
||||
cset = Perforce.getcset(d, path, host, user, pswd, parm)
|
||||
|
||||
ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host,base.replace('/', '.'), cset), d)
|
||||
ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host, base.replace('/', '.'), cset), d)
|
||||
|
||||
return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile)
|
||||
|
||||
|
@ -124,7 +124,7 @@ class Perforce(Fetch):
|
|||
Fetch urls
|
||||
"""
|
||||
|
||||
(host,depot,user,pswd,parm) = Perforce.doparse(loc, d)
|
||||
(host, depot, user, pswd, parm) = Perforce.doparse(loc, d)
|
||||
|
||||
if depot.find('/...') != -1:
|
||||
path = depot[:depot.find('/...')]
|
||||
|
@ -164,10 +164,10 @@ class Perforce(Fetch):
|
|||
raise FetchError(module)
|
||||
|
||||
if "label" in parm:
|
||||
depot = "%s@%s" % (depot,parm["label"])
|
||||
depot = "%s@%s" % (depot, parm["label"])
|
||||
else:
|
||||
cset = Perforce.getcset(d, depot, host, user, pswd, parm)
|
||||
depot = "%s@%s" % (depot,cset)
|
||||
depot = "%s@%s" % (depot, cset)
|
||||
|
||||
os.chdir(tmpfile)
|
||||
bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc)
|
||||
|
@ -189,7 +189,7 @@ class Perforce(Fetch):
|
|||
dest = list[0][len(path)+1:]
|
||||
where = dest.find("#")
|
||||
|
||||
os.system("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module,dest[:where],list[0]))
|
||||
os.system("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module, dest[:where], list[0]))
|
||||
count = count + 1
|
||||
|
||||
if count == 0:
|
||||
|
|
|
@ -38,7 +38,7 @@ class Wget(Fetch):
|
|||
"""
|
||||
Check to see if a given url can be fetched with wget.
|
||||
"""
|
||||
return ud.type in ['http','https','ftp']
|
||||
return ud.type in ['http', 'https', 'ftp']
|
||||
|
||||
def localpath(self, url, ud, d):
|
||||
|
||||
|
|
|
@ -37,12 +37,12 @@ class SkipPackage(Exception):
|
|||
|
||||
__mtime_cache = {}
|
||||
def cached_mtime(f):
|
||||
if not __mtime_cache.has_key(f):
|
||||
if f not in __mtime_cache:
|
||||
__mtime_cache[f] = os.stat(f)[8]
|
||||
return __mtime_cache[f]
|
||||
|
||||
def cached_mtime_noerror(f):
|
||||
if not __mtime_cache.has_key(f):
|
||||
if f not in __mtime_cache:
|
||||
try:
|
||||
__mtime_cache[f] = os.stat(f)[8]
|
||||
except OSError:
|
||||
|
|
|
@ -311,7 +311,7 @@ def finalize(fn, d):
|
|||
all_handlers = {}
|
||||
for var in bb.data.getVar('__BBHANDLERS', d) or []:
|
||||
# try to add the handler
|
||||
handler = bb.data.getVar(var,d)
|
||||
handler = bb.data.getVar(var, d)
|
||||
bb.event.register(var, handler)
|
||||
|
||||
tasklist = bb.data.getVar('__BBTASKS', d) or []
|
||||
|
|
|
@ -90,7 +90,7 @@ def get_statements(filename, absolsute_filename, base_name):
|
|||
statements = ast.StatementGroup()
|
||||
|
||||
lineno = 0
|
||||
while 1:
|
||||
while True:
|
||||
lineno = lineno + 1
|
||||
s = file.readline()
|
||||
if not s: break
|
||||
|
@ -118,7 +118,7 @@ def handle(fn, d, include):
|
|||
bb.msg.debug(2, bb.msg.domain.Parsing, "BB " + fn + ": handle(data, include)")
|
||||
|
||||
(root, ext) = os.path.splitext(os.path.basename(fn))
|
||||
base_name = "%s%s" % (root,ext)
|
||||
base_name = "%s%s" % (root, ext)
|
||||
init(d)
|
||||
|
||||
if ext == ".bbclass":
|
||||
|
@ -164,7 +164,7 @@ def handle(fn, d, include):
|
|||
return d
|
||||
|
||||
def feeder(lineno, s, fn, root, statements):
|
||||
global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__,__infunc__, __body__, classes, bb, __residue__
|
||||
global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, classes, bb, __residue__
|
||||
if __infunc__:
|
||||
if s == '}':
|
||||
__body__.append('')
|
||||
|
|
|
@ -89,7 +89,7 @@ def handle(fn, data, include):
|
|||
|
||||
statements = ast.StatementGroup()
|
||||
lineno = 0
|
||||
while 1:
|
||||
while True:
|
||||
lineno = lineno + 1
|
||||
s = f.readline()
|
||||
if not s: break
|
||||
|
|
|
@ -52,7 +52,7 @@ class PersistData:
|
|||
except OSError:
|
||||
bb.utils.mkdirhier(self.cachedir)
|
||||
|
||||
self.cachefile = os.path.join(self.cachedir,"bb_persist_data.sqlite3")
|
||||
self.cachefile = os.path.join(self.cachedir, "bb_persist_data.sqlite3")
|
||||
bb.msg.debug(1, bb.msg.domain.PersistData, "Using '%s' as the persistent data cache" % self.cachefile)
|
||||
|
||||
self.connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level=None)
|
||||
|
@ -113,7 +113,7 @@ class PersistData:
|
|||
try:
|
||||
self.connection.execute(*query)
|
||||
return
|
||||
except sqlite3.OperationalError, e:
|
||||
except sqlite3.OperationalError as e:
|
||||
if 'database is locked' in str(e):
|
||||
continue
|
||||
raise
|
||||
|
|
|
@ -109,8 +109,7 @@ class RunQueueSchedulerSpeed(RunQueueScheduler):
|
|||
|
||||
self.rq = runqueue
|
||||
|
||||
sortweight = deepcopy(self.rq.runq_weight)
|
||||
sortweight.sort()
|
||||
sortweight = sorted(deepcopy(self.rq.runq_weight))
|
||||
copyweight = deepcopy(self.rq.runq_weight)
|
||||
self.prio_map = []
|
||||
|
||||
|
@ -307,7 +306,7 @@ class RunQueue:
|
|||
weight[listid] = 1
|
||||
task_done[listid] = True
|
||||
|
||||
while 1:
|
||||
while True:
|
||||
next_points = []
|
||||
for listid in endpoints:
|
||||
for revdep in self.runq_depends[listid]:
|
||||
|
@ -631,7 +630,7 @@ class RunQueue:
|
|||
for dep in revdeps:
|
||||
if dep in self.runq_depends[listid]:
|
||||
#self.dump_data(taskData)
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "Task %s (%s) has circular dependency on %s (%s)" % (taskData.fn_index[self.runq_fnid[dep]], self.runq_task[dep] , taskData.fn_index[self.runq_fnid[listid]], self.runq_task[listid]))
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "Task %s (%s) has circular dependency on %s (%s)" % (taskData.fn_index[self.runq_fnid[dep]], self.runq_task[dep], taskData.fn_index[self.runq_fnid[listid]], self.runq_task[listid]))
|
||||
|
||||
bb.msg.note(2, bb.msg.domain.RunQueue, "Compute totals (have %s endpoint(s))" % len(endpoints))
|
||||
|
||||
|
@ -814,7 +813,7 @@ class RunQueue:
|
|||
bb.msg.debug(2, bb.msg.domain.RunQueue, "Stampfile %s < %s" % (stampfile, stampfile2))
|
||||
iscurrent = False
|
||||
except:
|
||||
bb.msg.debug(2, bb.msg.domain.RunQueue, "Exception reading %s for %s" % (stampfile2 , stampfile))
|
||||
bb.msg.debug(2, bb.msg.domain.RunQueue, "Exception reading %s for %s" % (stampfile2, stampfile))
|
||||
iscurrent = False
|
||||
|
||||
return iscurrent
|
||||
|
@ -948,7 +947,7 @@ class RunQueue:
|
|||
try:
|
||||
pipein, pipeout = os.pipe()
|
||||
pid = os.fork()
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "fork failed: %d (%s)" % (e.errno, e.strerror))
|
||||
if pid == 0:
|
||||
os.close(pipein)
|
||||
|
|
|
@ -115,7 +115,7 @@ class BitBakeServer():
|
|||
|
||||
def register_idle_function(self, function, data):
|
||||
"""Register a function to be called while the server is idle"""
|
||||
assert callable(function)
|
||||
assert hasattr(function, '__call__')
|
||||
self._idlefuns[function] = data
|
||||
|
||||
def idle_commands(self, delay):
|
||||
|
|
|
@ -112,7 +112,7 @@ class BitBakeServer(SimpleXMLRPCServer):
|
|||
|
||||
def register_idle_function(self, function, data):
|
||||
"""Register a function to be called while the server is idle"""
|
||||
assert callable(function)
|
||||
assert hasattr(function, '__call__')
|
||||
self._idlefuns[function] = data
|
||||
|
||||
def serve_forever(self):
|
||||
|
|
|
@ -34,7 +34,7 @@ def re_match_strings(target, strings):
|
|||
|
||||
for name in strings:
|
||||
if (name==target or
|
||||
re.search(name,target)!=None):
|
||||
re.search(name, target)!=None):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -539,7 +539,7 @@ class TaskData:
|
|||
Resolve all unresolved build and runtime targets
|
||||
"""
|
||||
bb.msg.note(1, bb.msg.domain.TaskData, "Resolving any missing task queue dependencies")
|
||||
while 1:
|
||||
while True:
|
||||
added = 0
|
||||
for target in self.get_unresolved_build_targets(dataCache):
|
||||
try:
|
||||
|
|
|
@ -157,7 +157,7 @@ class BuildResult(gobject.GObject):
|
|||
# format build-<year><month><day>-<ordinal> we can easily
|
||||
# pull it out.
|
||||
# TODO: Better to stat a file?
|
||||
(_ , date, revision) = identifier.split ("-")
|
||||
(_, date, revision) = identifier.split ("-")
|
||||
print(date)
|
||||
|
||||
year = int (date[0:4])
|
||||
|
@ -385,7 +385,7 @@ class BuildManager (gobject.GObject):
|
|||
build_directory])
|
||||
server.runCommand(["buildTargets", [conf.image], "rootfs"])
|
||||
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
class BuildManagerTreeView (gtk.TreeView):
|
||||
|
|
|
@ -63,7 +63,7 @@ class RunningBuild (gobject.GObject):
|
|||
# for the message.
|
||||
if hasattr(event, 'pid'):
|
||||
pid = event.pid
|
||||
if self.pids_to_task.has_key(pid):
|
||||
if pid in self.pids_to_task:
|
||||
(package, task) = self.pids_to_task[pid]
|
||||
parent = self.tasks_to_iter[(package, task)]
|
||||
|
||||
|
@ -93,12 +93,12 @@ class RunningBuild (gobject.GObject):
|
|||
(package, task) = (event._package, event._task)
|
||||
|
||||
# Save out this PID.
|
||||
self.pids_to_task[pid] = (package,task)
|
||||
self.pids_to_task[pid] = (package, task)
|
||||
|
||||
# Check if we already have this package in our model. If so then
|
||||
# that can be the parent for the task. Otherwise we create a new
|
||||
# top level for the package.
|
||||
if (self.tasks_to_iter.has_key ((package, None))):
|
||||
if ((package, None) in self.tasks_to_iter):
|
||||
parent = self.tasks_to_iter[(package, None)]
|
||||
else:
|
||||
parent = self.model.append (None, (None,
|
||||
|
|
|
@ -207,7 +207,7 @@ def init(server, eventHandler):
|
|||
if ret != True:
|
||||
print("Couldn't run command! %s" % ret)
|
||||
return
|
||||
except xmlrpclib.Fault, x:
|
||||
except xmlrpclib.Fault as x:
|
||||
print("XMLRPC Fault getting commandline:\n %s" % x)
|
||||
return
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ def init (server, eventHandler):
|
|||
if ret != True:
|
||||
print("Couldn't get default commandline! %s" % ret)
|
||||
return 1
|
||||
except xmlrpclib.Fault, x:
|
||||
except xmlrpclib.Fault as x:
|
||||
print("XMLRPC Fault getting commandline:\n %s" % x)
|
||||
return 1
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ def init(server, eventHandler):
|
|||
if ret != True:
|
||||
print("Couldn't get default commandline! %s" % ret)
|
||||
return 1
|
||||
except xmlrpclib.Fault, x:
|
||||
except xmlrpclib.Fault as x:
|
||||
print("XMLRPC Fault getting commandline:\n %s" % x)
|
||||
return 1
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ class NCursesUI:
|
|||
if ret != True:
|
||||
print("Couldn't get default commandlind! %s" % ret)
|
||||
return
|
||||
except xmlrpclib.Fault, x:
|
||||
except xmlrpclib.Fault as x:
|
||||
print("XMLRPC Fault getting commandline:\n %s" % x)
|
||||
return
|
||||
|
||||
|
|
|
@ -104,10 +104,10 @@ class MetaDataLoader(gobject.GObject):
|
|||
gobject.idle_add (MetaDataLoader.emit_success_signal,
|
||||
self.loader)
|
||||
|
||||
except MetaDataLoader.LoaderThread.LoaderImportException, e:
|
||||
except MetaDataLoader.LoaderThread.LoaderImportException as e:
|
||||
gobject.idle_add (MetaDataLoader.emit_error_signal, self.loader,
|
||||
"Repository metadata corrupt")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
gobject.idle_add (MetaDataLoader.emit_error_signal, self.loader,
|
||||
"Unable to download repository metadata")
|
||||
print(e)
|
||||
|
@ -211,7 +211,7 @@ class BuildSetupDialog (gtk.Dialog):
|
|||
# Build
|
||||
button = gtk.Button ("_Build", None, True)
|
||||
image = gtk.Image ()
|
||||
image.set_from_stock (gtk.STOCK_EXECUTE,gtk.ICON_SIZE_BUTTON)
|
||||
image.set_from_stock (gtk.STOCK_EXECUTE, gtk.ICON_SIZE_BUTTON)
|
||||
button.set_image (image)
|
||||
self.add_action_widget (button, BuildSetupDialog.RESPONSE_BUILD)
|
||||
button.show_all ()
|
||||
|
|
|
@ -110,7 +110,7 @@ class UIXMLRPCServer (SimpleXMLRPCServer):
|
|||
return (sock, addr)
|
||||
except socket.timeout:
|
||||
pass
|
||||
return (None,None)
|
||||
return (None, None)
|
||||
|
||||
def close_request(self, request):
|
||||
if request is None:
|
||||
|
|
|
@ -72,9 +72,9 @@ def vercmp_part(a, b):
|
|||
if ca == None and cb == None:
|
||||
return 0
|
||||
|
||||
if type(ca) is types.StringType:
|
||||
if isinstance(ca, types.StringType):
|
||||
sa = ca in separators
|
||||
if type(cb) is types.StringType:
|
||||
if isinstance(cb, types.StringType):
|
||||
sb = cb in separators
|
||||
if sa and not sb:
|
||||
return -1
|
||||
|
@ -306,7 +306,7 @@ def better_compile(text, file, realfile, mode = "exec"):
|
|||
"""
|
||||
try:
|
||||
return compile(text, file, mode)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
# split the text into lines again
|
||||
body = text.split('\n')
|
||||
bb.msg.error(bb.msg.domain.Util, "Error in compiling python function in: ", realfile)
|
||||
|
@ -385,7 +385,7 @@ def lockfile(name):
|
|||
return lf
|
||||
# File no longer exists or changed, retry
|
||||
lf.close
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
continue
|
||||
|
||||
def unlockfile(lf):
|
||||
|
@ -546,7 +546,7 @@ def mkdirhier(dir):
|
|||
try:
|
||||
os.makedirs(dir)
|
||||
bb.msg.debug(2, bb.msg.domain.Util, "created " + dir)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise e
|
||||
|
||||
|
@ -561,7 +561,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||
try:
|
||||
if not sstat:
|
||||
sstat = os.lstat(src)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print("movefile: Stating source file failed...", e)
|
||||
return None
|
||||
|
||||
|
@ -577,7 +577,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||
try:
|
||||
os.unlink(dest)
|
||||
destexists = 0
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
if stat.S_ISLNK(sstat[stat.ST_MODE]):
|
||||
|
@ -589,7 +589,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||
#os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
|
||||
os.unlink(src)
|
||||
return os.lstat(dest)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print("movefile: failed to properly create symlink:", dest, "->", target, e)
|
||||
return None
|
||||
|
||||
|
@ -598,7 +598,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||
try:
|
||||
os.rename(src, dest)
|
||||
renamefailed = 0
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if e[0] != errno.EXDEV:
|
||||
# Some random error.
|
||||
print("movefile: Failed to move", src, "to", dest, e)
|
||||
|
@ -612,7 +612,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||
shutil.copyfile(src, dest + "#new")
|
||||
os.rename(dest + "#new", dest)
|
||||
didcopy = 1
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print('movefile: copy', src, '->', dest, 'failed.', e)
|
||||
return None
|
||||
else:
|
||||
|
@ -626,7 +626,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||
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.unlink(src)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print("movefile: Failed to chown/chmod/unlink", dest, e)
|
||||
return None
|
||||
|
||||
|
@ -647,7 +647,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
|
|||
try:
|
||||
if not sstat:
|
||||
sstat = os.lstat(src)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print("copyfile: Stating source file failed...", e)
|
||||
return False
|
||||
|
||||
|
@ -663,7 +663,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
|
|||
try:
|
||||
os.unlink(dest)
|
||||
destexists = 0
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
if stat.S_ISLNK(sstat[stat.ST_MODE]):
|
||||
|
@ -674,7 +674,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
|
|||
os.symlink(target, dest)
|
||||
#os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
|
||||
return os.lstat(dest)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print("copyfile: failed to properly create symlink:", dest, "->", target, e)
|
||||
return False
|
||||
|
||||
|
@ -682,7 +682,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
|
|||
try: # For safety copy then move it over.
|
||||
shutil.copyfile(src, dest + "#new")
|
||||
os.rename(dest + "#new", dest)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print('copyfile: copy', src, '->', dest, 'failed.', e)
|
||||
return False
|
||||
else:
|
||||
|
@ -694,7 +694,7 @@ def copyfile(src, dest, newmtime = None, sstat = None):
|
|||
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:
|
||||
except Exception as e:
|
||||
print("copyfile: Failed to chown/chmod/unlink", dest, e)
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in New Issue