summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/data_smart.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index a7cae77d36..f0187b7a17 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -54,27 +54,36 @@ def infer_caller_details(loginfo, parent = False, varval = True):
54 return 54 return
55 # Infer caller's likely values for variable (var) and value (value), 55 # Infer caller's likely values for variable (var) and value (value),
56 # to reduce clutter in the rest of the code. 56 # to reduce clutter in the rest of the code.
57 if varval and ('variable' not in loginfo or 'detail' not in loginfo): 57 above = None
58 def set_above():
58 try: 59 try:
59 raise Exception 60 raise Exception
60 except Exception: 61 except Exception:
61 tb = sys.exc_info()[2] 62 tb = sys.exc_info()[2]
62 if parent: 63 if parent:
63 above = tb.tb_frame.f_back.f_back 64 return tb.tb_frame.f_back.f_back.f_back
64 else: 65 else:
65 above = tb.tb_frame.f_back 66 return tb.tb_frame.f_back.f_back
66 lcls = above.f_locals.items() 67
68 if varval and ('variable' not in loginfo or 'detail' not in loginfo):
69 if not above:
70 above = set_above()
71 lcls = above.f_locals.items()
67 for k, v in lcls: 72 for k, v in lcls:
68 if k == 'value' and 'detail' not in loginfo: 73 if k == 'value' and 'detail' not in loginfo:
69 loginfo['detail'] = v 74 loginfo['detail'] = v
70 if k == 'var' and 'variable' not in loginfo: 75 if k == 'var' and 'variable' not in loginfo:
71 loginfo['variable'] = v 76 loginfo['variable'] = v
72 # Infer file/line/function from traceback 77 # Infer file/line/function from traceback
78 # Don't use traceback.extract_stack() since it fills the line contents which
79 # we don't need and that hits stat syscalls
73 if 'file' not in loginfo: 80 if 'file' not in loginfo:
74 depth = 3 81 if not above:
75 if parent: 82 above = set_above()
76 depth = 4 83 f = above.f_back
77 file, line, func, text = traceback.extract_stack(limit = depth)[0] 84 line = f.f_lineno
85 file = f.f_code.co_filename
86 func = f.f_code.co_name
78 loginfo['file'] = file 87 loginfo['file'] = file
79 loginfo['line'] = line 88 loginfo['line'] = line
80 if func not in loginfo: 89 if func not in loginfo: