summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-04-11 17:03:55 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:33 +0100
commit1180bab54e2879401f3586c91a48174191a1ee8b (patch)
treea45aeee20eb5969cc1ac778fac47134929f4e021 /bitbake/lib/bb/utils.py
parent5b216c8000dbc3ed9f3e996242eb24269fcaf919 (diff)
downloadopenembedded-core-1180bab54e2879401f3586c91a48174191a1ee8b.tar.gz
openembedded-core-1180bab54e2879401f3586c91a48174191a1ee8b.tar.bz2
openembedded-core-1180bab54e2879401f3586c91a48174191a1ee8b.zip
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>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 7446be875d..02668b16c4 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -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