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

Unified Diff: tools/telemetry/telemetry/core/util.py

Issue 121493004: [telemetry] Implement per-pixel algorithms in Bitmap as a C++ extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 6 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
« no previous file with comments | « tools/telemetry/telemetry/core/tab.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/util.py
diff --git a/tools/telemetry/telemetry/core/util.py b/tools/telemetry/telemetry/core/util.py
index be8212e659351dfc9cb2a125e4471ef5d36f013d..28912212ff42631729d7a82683d795784b8ad34d 100644
--- a/tools/telemetry/telemetry/core/util.py
+++ b/tools/telemetry/telemetry/core/util.py
@@ -1,6 +1,7 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import imp
import inspect
import logging
import os
@@ -145,6 +146,7 @@ def GetBuildDirectories():
for build_type in build_types:
yield build_dir, build_type
+
def FindSupportBinary(binary_name, executable=True):
"""Returns the path to the given binary name."""
# TODO(tonyg/dtu): This should support finding binaries in cloud storage.
@@ -164,3 +166,23 @@ def FindSupportBinary(binary_name, executable=True):
command_mtime = candidate_mtime
return command
+
+
+def FindSupportModule(module_name):
+ """Like FindSupportBinary but uses imp.find_module to find a Python module."""
+ module = None
+ module_mtime = 0
+
+ chrome_root = GetChromiumSrcDir()
+ for build_dir, build_type in GetBuildDirectories():
+ path = os.path.join(chrome_root, build_dir, build_type)
+ try:
+ candidate = imp.find_module(module_name, [path])
+ except ImportError:
+ continue
+ candidate_mtime = os.stat(candidate[1]).st_mtime
+ if candidate_mtime > module_mtime:
+ module = candidate
+ module_mtime = candidate_mtime
+
+ return module
« no previous file with comments | « tools/telemetry/telemetry/core/tab.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698