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

Unified Diff: systrace/systrace/__init__.py

Issue 1776013005: [DO NOT COMMIT] Refactor systrace to support new clock sync design (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: fix categories issue Created 4 years, 9 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 | « systrace/bin/systrace ('k') | systrace/systrace/agents/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: systrace/systrace/__init__.py
diff --git a/systrace/systrace/__init__.py b/systrace/systrace/__init__.py
index ca3e206fdd8f2b8e5facc81da817abd7d2ca143e..5c2e68304eb2878a3f9aa7c972d6c343d1eb5706 100644
--- a/systrace/systrace/__init__.py
+++ b/systrace/systrace/__init__.py
@@ -1,3 +1,26 @@
# Copyright 2016 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 os
+import sys
+
+def _JoinPath(*path_parts):
+ return os.path.abspath(os.path.join(*path_parts))
+
+
+def _AddDirToPythonPath(*path_parts):
+ path = _JoinPath(*path_parts)
+ if os.path.isdir(path) and path not in sys.path:
+ # Some call sites that use Telemetry assume that sys.path[0] is the
+ # directory containing the script, so we add these extra paths to right
+ # after sys.path[0].
+ sys.path.insert(1, path)
+
+_CATAPULT_DIR = os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), os.path.pardir, os.path.pardir)
+
+_AddDirToPythonPath(_CATAPULT_DIR, 'catapult_base')
+_AddDirToPythonPath(_CATAPULT_DIR, 'devil')
+_AddDirToPythonPath(_CATAPULT_DIR, 'systrace')
+_AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_trace_event')
+_AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_trace_event', 'py_trace_event')
« no previous file with comments | « systrace/bin/systrace ('k') | systrace/systrace/agents/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698