Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: build/android/pylib/remote/device/appurify_sanitized.py

Issue 1571803002: [Android] Prepare build/android/ for catapult+devil. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@create-device-library-links
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
« no previous file with comments | « build/android/pylib/perf/test_runner.py ('k') | build/android/pylib/results/flakiness_dashboard/results_uploader.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698