1# Copyright (c) 2015 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import os
6import sys
7
8
9def _AddToPathIfNeeded(path):
10  if path not in sys.path:
11    sys.path.insert(0, path)
12
13
14def _UpdateSysPathIfNeeded():
15  catapult_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
16  catapult_third_party_path = os.path.abspath(os.path.join(
17      catapult_path, 'third_party'))
18  _AddToPathIfNeeded(os.path.join(catapult_path, 'catapult_base'))
19  _AddToPathIfNeeded(os.path.join(catapult_third_party_path, 'beautifulsoup4'))
20  _AddToPathIfNeeded(os.path.join(catapult_third_party_path, 'html5lib-python'))
21  _AddToPathIfNeeded(os.path.join(catapult_third_party_path, 'six'))
22  _AddToPathIfNeeded(os.path.join(catapult_third_party_path, 'Paste'))
23  _AddToPathIfNeeded(os.path.join(catapult_third_party_path, 'py_vulcanize'))
24  _AddToPathIfNeeded(os.path.join(catapult_third_party_path, 'webapp2'))
25  _AddToPathIfNeeded(os.path.join(catapult_third_party_path, 'WebOb'))
26  _AddToPathIfNeeded(os.path.join(catapult_path, 'tracing'))
27  _AddToPathIfNeeded(os.path.join(catapult_path, 'perf_insights'))
28  _AddToPathIfNeeded(os.path.join(catapult_path, 'dashboard'))
29
30
31_UpdateSysPathIfNeeded()
32