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 | 4 import os |
5 import sys | 5 import sys |
6 | 6 |
7 def _JoinPath(*path_parts): | 7 def _JoinPath(*path_parts): |
8 return os.path.abspath(os.path.join(*path_parts)) | 8 return os.path.abspath(os.path.join(*path_parts)) |
9 | 9 |
10 | 10 |
11 def _AddDirToPythonPath(*path_parts): | 11 def _AddDirToPythonPath(*path_parts): |
12 path = _JoinPath(*path_parts) | 12 path = _JoinPath(*path_parts) |
13 if os.path.isdir(path) and path not in sys.path: | 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 | 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 | 15 # directory containing the script, so we add these extra paths to right |
16 # after sys.path[0]. | 16 # after sys.path[0]. |
17 sys.path.insert(1, path) | 17 sys.path.insert(1, path) |
18 | 18 |
19 _CATAPULT_DIR = os.path.join( | 19 _CATAPULT_DIR = os.path.join( |
20 os.path.dirname(os.path.abspath(__file__)), os.path.pardir, os.path.pardir) | 20 os.path.dirname(os.path.abspath(__file__)), os.path.pardir, os.path.pardir) |
21 | 21 |
22 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'battor') | 22 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'battor') |
| 23 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'monsoon') |
23 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_utils') | 24 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_utils') |
24 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_trace_event') | 25 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_trace_event') |
25 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_trace_event', 'py_trace_event') | 26 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_trace_event', 'py_trace_event') |
26 _AddDirToPythonPath(_CATAPULT_DIR, 'devil') | 27 _AddDirToPythonPath(_CATAPULT_DIR, 'devil') |
27 _AddDirToPythonPath(_CATAPULT_DIR, 'systrace') | 28 _AddDirToPythonPath(_CATAPULT_DIR, 'systrace') |
28 _AddDirToPythonPath(_CATAPULT_DIR, 'tracing') | 29 _AddDirToPythonPath(_CATAPULT_DIR, 'tracing') |
OLD | NEW |