| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 | 4 |
| 5 """A library for cross-platform browser tests.""" | 5 """A library for cross-platform browser tests.""" |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 import glob | 8 import glob |
| 9 | 9 |
| 10 try: | 10 try: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 def _AddDirToPythonPath(*path_parts): | 37 def _AddDirToPythonPath(*path_parts): |
| 38 path = _JoinPath(*path_parts) | 38 path = _JoinPath(*path_parts) |
| 39 _InsertPath(path) | 39 _InsertPath(path) |
| 40 | 40 |
| 41 | 41 |
| 42 # Matches only 0 or 1 glob results | 42 # Matches only 0 or 1 glob results |
| 43 def _AddOptionalSingleGlobToPythonPath(*match_path_parts): | 43 def _AddOptionalSingleGlobToPythonPath(*match_path_parts): |
| 44 absolute_match_path = _JoinPath(*match_path_parts) | 44 absolute_match_path = _JoinPath(*match_path_parts) |
| 45 paths = glob.glob(absolute_match_path) | 45 paths = glob.glob(absolute_match_path) |
| 46 if len(paths) > 1: | 46 if len(paths) > 1: |
| 47 raise ImportError("More than one result was found for glob {}" | 47 raise ImportError("More than one result was found for glob {}"\ |
| 48 .format(absolute_match_path)) | 48 .format(absolute_match_path)) |
| 49 for path in paths: | 49 for path in paths: |
| 50 _InsertPath(path) | 50 _InsertPath(path) |
| 51 | 51 |
| 52 | 52 |
| 53 # Add Catapult dependencies to our path. | 53 # Add Catapult dependencies to our path. |
| 54 # util depends on py_utils, so we can't use it to get the catapult dir. | 54 # util depends on py_utils, so we can't use it to get the catapult dir. |
| 55 _CATAPULT_DIR = os.path.join( | 55 _CATAPULT_DIR = os.path.join( |
| 56 os.path.dirname(os.path.abspath(__file__)), '..', '..') | 56 os.path.dirname(os.path.abspath(__file__)), '..', '..') |
| 57 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_utils') | 57 _AddDirToPythonPath(_CATAPULT_DIR, 'common', 'py_utils') |
| 58 _AddDirToPythonPath(_CATAPULT_DIR, 'dependency_manager') | 58 _AddDirToPythonPath(_CATAPULT_DIR, 'dependency_manager') |
| (...skipping 22 matching lines...) Expand all Loading... |
| 81 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'mox3') | 81 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'mox3') |
| 82 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'png') | 82 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'png') |
| 83 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'pyfakefs') | 83 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'pyfakefs') |
| 84 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'web-page-replay') | 84 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'web-page-replay') |
| 85 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'websocket-client') | 85 _AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'websocket-client') |
| 86 _AddOptionalSingleGlobToPythonPath(_TELEMETRY_3P, 'cv2', 'lib', 'cv2_*') | 86 _AddOptionalSingleGlobToPythonPath(_TELEMETRY_3P, 'cv2', 'lib', 'cv2_*') |
| 87 _AddOptionalSingleGlobToPythonPath(_TELEMETRY_3P, 'numpy', 'lib', 'numpy_*') | 87 _AddOptionalSingleGlobToPythonPath(_TELEMETRY_3P, 'numpy', 'lib', 'numpy_*') |
| 88 | 88 |
| 89 # Install Telemtry global hooks. | 89 # Install Telemtry global hooks. |
| 90 global_hooks.InstallHooks() | 90 global_hooks.InstallHooks() |
| OLD | NEW |