From 1fc840ffc0267ecf3a15c4a59ab44869ef1d6339 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 9 May 2013 16:31:22 +0000 Subject: meta: python3 megapatch This needs splutting into smaller units, WIP atm. (From OE-Core rev: 21529228a7dca96a6a1b44ed9380c523efdeeb3e) Signed-off-by: Richard Purdie --- meta/lib/oe/qa.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'meta/lib/oe/qa.py') diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py index 3cfeee737b..ff0c87a383 100644 --- a/meta/lib/oe/qa.py +++ b/meta/lib/oe/qa.py @@ -43,17 +43,17 @@ class ELFFile: if not os.path.isfile(self.name): raise NotELFFileError("%s is not a normal file" % self.name) - self.file = file(self.name, "r") - # Read 4k which should cover most of the headers we're after - self.data = self.file.read(4096) + with open(self.name, "rb") as f: + # Read 4k which should cover most of the headers we're after + self.data = f.read(4096) if len(self.data) < ELFFile.EI_NIDENT + 4: raise NotELFFileError("%s is not an ELF" % self.name) self.my_assert(self.data[0], chr(0x7f) ) - self.my_assert(self.data[1], 'E') - self.my_assert(self.data[2], 'L') - self.my_assert(self.data[3], 'F') + self.my_assert(self.data[1], b'E') + self.my_assert(self.data[2], b'L') + self.my_assert(self.data[3], b'F') if self.bits == 0: if self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS32): self.bits = 32 @@ -148,4 +148,4 @@ if __name__ == "__main__": import sys elf = ELFFile(sys.argv[1]) elf.open() - print elf.isDynamic() + print(elf.isDynamic()) -- cgit v1.2.3-54-g00ecf