summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/qa.py
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2019-12-13 11:33:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-29 09:27:16 +0000
commit3780744968f0b26cc2f4fea61a0cc594da6fa616 (patch)
tree7524dc36d40b39698f797b4c56f901e82938dac0 /meta/lib/oe/qa.py
parentf6a35934540e910794b8729ecc278189a39b710f (diff)
downloadpoky-3780744968f0b26cc2f4fea61a0cc594da6fa616.tar.gz
chrpath: Cleanup and fix previous patch
Ensure self.data isn't accessed without assignment. Also clean up old style popen use and replace with modern/simpler subprocess. (From OE-Core rev: 39825cba4761a6b4b2473825705975f9f421ec8b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/qa.py')
-rw-r--r--meta/lib/oe/qa.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 21066c4dc3..ea831b930a 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -41,13 +41,15 @@ class ELFFile:
41 def __init__(self, name): 41 def __init__(self, name):
42 self.name = name 42 self.name = name
43 self.objdump_output = {} 43 self.objdump_output = {}
44 self.data = None
44 45
45 # Context Manager functions to close the mmap explicitly 46 # Context Manager functions to close the mmap explicitly
46 def __enter__(self): 47 def __enter__(self):
47 return self 48 return self
48 49
49 def __exit__(self, exc_type, exc_value, traceback): 50 def __exit__(self, exc_type, exc_value, traceback):
50 self.data.close() 51 if self.data:
52 self.data.close()
51 53
52 def open(self): 54 def open(self):
53 with open(self.name, "rb") as f: 55 with open(self.name, "rb") as f: