From 75332cf14ad43f5ff045124617a7347d778a06f0 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Fri, 19 Oct 2018 18:18:11 +0100 Subject: [PATCH] module/systrace: Fix platform_tools use platform_tools is only updated after the very first connection to the target, and it will be None until then. As I understand it, using `from devlib.utils.android import platform_tools` will create a symbol local to the imported systrace module for `platform_tools` that just takes its current value, and it won't be updated when it should be. Changing the `from x import y` statement to a simple `import x` seems to counteract this. --- devlib/trace/systrace.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devlib/trace/systrace.py b/devlib/trace/systrace.py index cbd458d..72169cb 100644 --- a/devlib/trace/systrace.py +++ b/devlib/trace/systrace.py @@ -21,7 +21,7 @@ from tempfile import NamedTemporaryFile from devlib.exception import TargetStableError, HostError from devlib.trace import TraceCollector -from devlib.utils.android import platform_tools +import devlib.utils.android from devlib.utils.misc import memoized @@ -83,6 +83,7 @@ class SystraceCollector(TraceCollector): # Try to find a systrace binary self.systrace_binary = None + platform_tools = devlib.utils.android.platform_tools systrace_binary_path = os.path.join(platform_tools, 'systrace', 'systrace.py') if not os.path.isfile(systrace_binary_path): raise HostError('Could not find any systrace binary under {}'.format(platform_tools))