| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 import os |
| 5 import sys |
| 6 |
| 7 def _JoinPath(*path_parts): |
| 8 return os.path.abspath(os.path.join(*path_parts)) |
| 9 |
| 10 |
| 11 def _AddDirToPythonPath(*path_parts): |
| 12 path = _JoinPath(*path_parts) |
| 13 if os.path.isdir(path) and path not in sys.path: |
| 14 # Some call sites that use Telemetry assume that sys.path[0] is the |
| 15 # directory containing the script, so we add these extra paths to right |
| 16 # after sys.path[0]. |
| 17 sys.path.insert(1, path) |
| 18 |
| 19 _CATAPULT_DIR = os.path.join( |
| 20 os.path.dirname(os.path.abspath(__file__)), os.path.pardir, os.path.pardir) |
| 21 |
| 22 _AddDirToPythonPath(_CATAPULT_DIR, 'catapult_base') |
| 23 _AddDirToPythonPath(_CATAPULT_DIR, 'devil') |
| 24 _AddDirToPythonPath(_CATAPULT_DIR, 'systrace') |
| 25 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_trace_event') |
| 26 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_trace_event', 'py_trace_event') |
| OLD | NEW |