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: tools/telemetry/catapult_base/dependency_manager/dependency_manager.py

Issue 1391403003: Add priority groups to local paths in the dependency manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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: tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
diff --git a/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py b/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
index 9e1de84fcfe70e92f847e353ea4aa405e467fba5..3dfb3366595d18d98dd2add3ae5a59b9be2fdf28 100644
--- a/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
+++ b/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
@@ -214,10 +214,20 @@ class DependencyManager(object):
Returns: A path to a local file, or None if not found.
"""
if dependency_info:
- paths = dependency_info.local_paths
- for local_path in paths:
- if os.path.exists(local_path):
- return local_path
+ local_paths = dependency_info.local_paths
+ found_path = None
+ for priority_group in local_paths:
+ # A list of paths in local_paths implies the same priority, so return
+ # the most recently modified one.
+ found_path_mtime = 0
+ for path in priority_group:
+ if os.path.exists(path):
+ mtime = os.stat(path).st_mtime
eakuefner 2015/10/09 16:29:17 mtime = os.path.getmtime(path)
+ if mtime > found_path_mtime:
+ found_path = path
+ found_path_mtime = mtime
+ if found_path:
+ return found_path
return None
@staticmethod

Powered by Google App Engine
This is Rietveld 408576698