1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 12:29:55 +00:00

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:
Chris Larson
2010-04-11 17:03:55 -07:00
committed by Richard Purdie
parent 5b216c8000
commit 1180bab54e
26 changed files with 268 additions and 269 deletions
+16 -16
View File
@@ -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