summaryrefslogtreecommitdiff
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-07 13:56:01 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 14:04:18 +0100
commitb2d10f15db23246e3957b69d77433f87674928bb (patch)
treec3233063c1ed7ee2115c2052a1e41f3c2b09e936 /meta/classes
parentfafeb381c48291fa65c634c01c244843c8d7fad3 (diff)
downloadopenembedded-core-b2d10f15db23246e3957b69d77433f87674928bb.tar.gz
openembedded-core-b2d10f15db23246e3957b69d77433f87674928bb.tar.bz2
openembedded-core-b2d10f15db23246e3957b69d77433f87674928bb.zip
sanity.bbclass: Use open(), not file()
file() syntax is removed in python 3, use open() instead. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/sanity.bbclass24
1 files changed, 12 insertions, 12 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 766e97e916..601ef1fb70 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -232,7 +232,7 @@ def check_create_long_filename(filepath, pathname):
try:
if not os.path.exists(filepath):
bb.utils.mkdirhier(filepath)
- f = file(testfile, "w")
+ f = open(testfile, "w")
f.close()
os.remove(testfile)
except IOError as e:
@@ -339,7 +339,7 @@ def check_gcc_march(sanity_data):
if sanity_data.getVar("BUILD_CFLAGS",True).find("-march") < 0:
# Construct a test file
- f = file("gcc_test.c", "w")
+ f = open("gcc_test.c", "w")
f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n")
f.close()
import commands
@@ -561,7 +561,7 @@ def check_sanity(sanity_data):
last_sstate_dir = ""
sanityverfile = 'conf/sanity_info'
if os.path.exists(sanityverfile):
- f = file(sanityverfile, 'r')
+ f = open(sanityverfile, 'r')
for line in f:
if line.startswith('SANITY_VERSION'):
last_sanity_version = int(line.split()[1])
@@ -584,7 +584,7 @@ def check_sanity(sanity_data):
if last_sstate_dir != sstate_dir:
messages = messages + check_sanity_sstate_dir_change(sstate_dir, sanity_data)
if os.path.exists("conf") and not messages:
- f = file(sanityverfile, 'w')
+ f = open(sanityverfile, 'w')
f.write("SANITY_VERSION %s\n" % sanity_version)
f.write("TMPDIR %s\n" % tmpdir)
f.write("SSTATE_DIR %s\n" % sstate_dir)
@@ -594,13 +594,13 @@ def check_sanity(sanity_data):
#
checkfile = os.path.join(tmpdir, "saved_tmpdir")
if os.path.exists(checkfile):
- f = file(checkfile, "r")
+ f = open(checkfile, "r")
saved_tmpdir = f.read().strip()
if (saved_tmpdir != tmpdir):
messages = messages + "Error, TMPDIR has changed location. You need to either move it back to %s or rebuild\n" % saved_tmpdir
else:
bb.utils.mkdirhier(tmpdir)
- f = file(checkfile, "w")
+ f = open(checkfile, "w")
f.write(tmpdir)
f.close()
@@ -610,17 +610,17 @@ def check_sanity(sanity_data):
current_abi = sanity_data.getVar('OELAYOUT_ABI', True)
abifile = sanity_data.getVar('SANITY_ABIFILE', True)
if os.path.exists(abifile):
- f = file(abifile, "r")
+ f = open(abifile, "r")
abi = f.read().strip()
if not abi.isdigit():
- f = file(abifile, "w")
+ f = open(abifile, "w")
f.write(current_abi)
elif abi == "2" and current_abi == "3":
bb.note("Converting staging from layout version 2 to layout version 3")
subprocess.call(sanity_data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots"), shell=True)
subprocess.call(sanity_data.expand("ln -s sysroots ${TMPDIR}/staging"), shell=True)
subprocess.call(sanity_data.expand("cd ${TMPDIR}/stamps; for i in */*do_populate_staging; do new=`echo $i | sed -e 's/do_populate_staging/do_populate_sysroot/'`; mv $i $new; done"), shell=True)
- f = file(abifile, "w")
+ f = open(abifile, "w")
f.write(current_abi)
elif abi == "3" and current_abi == "4":
bb.note("Converting staging layout from version 3 to layout version 4")
@@ -628,14 +628,14 @@ def check_sanity(sanity_data):
subprocess.call(sanity_data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}"), shell=True)
subprocess.call(sanity_data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}"), shell=True)
- f = file(abifile, "w")
+ f = open(abifile, "w")
f.write(current_abi)
elif abi == "4":
messages = messages + "Staging layout has changed. The cross directory has been deprecated and cross packages are now built under the native sysroot.\nThis requires a rebuild.\n"
elif abi == "5" and current_abi == "6":
bb.note("Converting staging layout from version 5 to layout version 6")
subprocess.call(sanity_data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}"), shell=True)
- f = file(abifile, "w")
+ f = open(abifile, "w")
f.write(current_abi)
elif abi == "7" and current_abi == "8":
messages = messages + "Your configuration is using stamp files including the sstate hash but your build directory was built with stamp files that do not include this.\nTo continue, either rebuild or switch back to the OEBasic signature handler with BB_SIGNATURE_HANDLER = 'OEBasic'.\n"
@@ -645,7 +645,7 @@ def check_sanity(sanity_data):
# Code to convert from one ABI to another could go here if possible.
messages = messages + "Error, TMPDIR has changed its layout version number (%s to %s) and you need to either rebuild, revert or adjust it at your own risk.\n" % (abi, current_abi)
else:
- f = file(abifile, "w")
+ f = open(abifile, "w")
f.write(current_abi)
f.close()