Index: build/android/pylib/remote/device/appurify_sanitized.py |
diff --git a/build/android/pylib/remote/device/appurify_sanitized.py b/build/android/pylib/remote/device/appurify_sanitized.py |
index a75d63d7e8ed34bb765beb17866580b8a23bc038..48736d5617ff0059ed2cacf826334f6a26bd29e3 100644 |
--- a/build/android/pylib/remote/device/appurify_sanitized.py |
+++ b/build/android/pylib/remote/device/appurify_sanitized.py |
@@ -5,27 +5,30 @@ |
import contextlib |
import logging |
import os |
-import sys |
-from pylib import constants |
+from pylib.constants import host_paths |
-sys.path.append(os.path.join( |
- constants.DIR_SOURCE_ROOT, 'third_party', 'requests', 'src')) |
-sys.path.append(os.path.join( |
- constants.DIR_SOURCE_ROOT, 'third_party', 'appurify-python', 'src')) |
-handlers_before = list(logging.getLogger().handlers) |
+_REQUESTS_PATH = os.path.join( |
+ host_paths.DIR_SOURCE_ROOT, 'third_party', 'requests', 'src') |
+_APPURIFY_PYTHON_PATH = os.path.join( |
+ host_paths.DIR_SOURCE_ROOT, 'third_party', 'appurify-python', 'src') |
-import appurify.api # pylint: disable=import-error |
-import appurify.utils # pylint: disable=import-error |
+with host_paths.SysPath(_REQUESTS_PATH), ( |
+ host_paths.SysPath(_APPURIFY_PYTHON_PATH)): |
-handlers_after = list(logging.getLogger().handlers) |
-new_handler = list(set(handlers_after) - set(handlers_before)) |
-while new_handler: |
- logging.info("Removing logging handler.") |
- logging.getLogger().removeHandler(new_handler.pop()) |
+ handlers_before = list(logging.getLogger().handlers) |
-api = appurify.api |
-utils = appurify.utils |
+ import appurify.api # pylint: disable=import-error |
+ import appurify.utils # pylint: disable=import-error |
+ |
+ handlers_after = list(logging.getLogger().handlers) |
+ new_handler = list(set(handlers_after) - set(handlers_before)) |
+ while new_handler: |
+ logging.info("Removing logging handler.") |
+ logging.getLogger().removeHandler(new_handler.pop()) |
+ |
+ api = appurify.api |
+ utils = appurify.utils |
# This is not thread safe. If multiple threads are ever supported with appurify |
# this may cause logging messages to go missing. |