| OLD | NEW |
| 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2014 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 import sys | 5 import sys |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 | 9 |
| 10 def _AddToPathIfNeeded(path): | 10 def _AddToPathIfNeeded(path): |
| 11 if path not in sys.path: | 11 if path not in sys.path: |
| 12 sys.path.insert(0, path) | 12 sys.path.insert(0, path) |
| 13 | 13 |
| 14 | 14 |
| 15 def UpdateSysPathIfNeeded(): | 15 def UpdateSysPathIfNeeded(): |
| 16 p = TracingProject() | 16 p = TracingProject() |
| 17 _AddToPathIfNeeded(p.catapult_path) | 17 _AddToPathIfNeeded(p.catapult_path) |
| 18 _AddToPathIfNeeded(p.tvcm_path) | 18 _AddToPathIfNeeded(p.py_vulcanize_path) |
| 19 _AddToPathIfNeeded(p.vinn_path) | 19 _AddToPathIfNeeded(p.vinn_path) |
| 20 | 20 |
| 21 _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'WebOb')) | 21 _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'WebOb')) |
| 22 _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'Paste')) | 22 _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'Paste')) |
| 23 _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'six')) | 23 _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'six')) |
| 24 _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'webapp2')) | 24 _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'webapp2')) |
| 25 | 25 |
| 26 | 26 |
| 27 def _FindAllFilesRecursive(source_paths): | 27 def _FindAllFilesRecursive(source_paths): |
| 28 assert isinstance(source_paths, list) | 28 assert isinstance(source_paths, list) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 53 return False | 53 return False |
| 54 | 54 |
| 55 | 55 |
| 56 class TracingProject(): | 56 class TracingProject(): |
| 57 catapult_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | 57 catapult_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) |
| 58 tracing_root_path = os.path.abspath(os.path.join(catapult_path, 'tracing')) | 58 tracing_root_path = os.path.abspath(os.path.join(catapult_path, 'tracing')) |
| 59 tracing_src_path = os.path.abspath(os.path.join(tracing_root_path, 'tracing')) | 59 tracing_src_path = os.path.abspath(os.path.join(tracing_root_path, 'tracing')) |
| 60 extras_path = os.path.join(tracing_src_path, 'extras') | 60 extras_path = os.path.join(tracing_src_path, 'extras') |
| 61 ui_extras_path = os.path.join(tracing_src_path, 'ui', 'extras') | 61 ui_extras_path = os.path.join(tracing_src_path, 'ui', 'extras') |
| 62 | 62 |
| 63 | |
| 64 catapult_third_party_path = os.path.abspath(os.path.join( | 63 catapult_third_party_path = os.path.abspath(os.path.join( |
| 65 catapult_path, 'third_party')) | 64 catapult_path, 'third_party')) |
| 66 | 65 |
| 67 tracing_third_party_path = os.path.abspath(os.path.join( | 66 tracing_third_party_path = os.path.abspath(os.path.join( |
| 68 tracing_root_path, 'third_party')) | 67 tracing_root_path, 'third_party')) |
| 69 tvcm_path = os.path.abspath(os.path.join(tracing_third_party_path, 'tvcm')) | 68 py_vulcanize_path = os.path.abspath(os.path.join( |
| 69 catapult_path, 'third_party', 'py_vulcanize')) |
| 70 vinn_path = os.path.abspath(os.path.join(catapult_third_party_path, 'vinn')) | 70 vinn_path = os.path.abspath(os.path.join(catapult_third_party_path, 'vinn')) |
| 71 | 71 |
| 72 jszip_path = os.path.abspath(os.path.join(tracing_third_party_path, 'jszip')) | 72 jszip_path = os.path.abspath(os.path.join(tracing_third_party_path, 'jszip')) |
| 73 | 73 |
| 74 glmatrix_path = os.path.abspath(os.path.join( | 74 glmatrix_path = os.path.abspath(os.path.join( |
| 75 tracing_third_party_path, 'gl-matrix', 'dist')) | 75 tracing_third_party_path, 'gl-matrix', 'dist')) |
| 76 | 76 |
| 77 ui_path = os.path.abspath(os.path.join(tracing_src_path, 'ui')) | 77 ui_path = os.path.abspath(os.path.join(tracing_src_path, 'ui')) |
| 78 d3_path = os.path.abspath(os.path.join(tracing_third_party_path, 'd3')) | 78 d3_path = os.path.abspath(os.path.join(tracing_third_party_path, 'd3')) |
| 79 chai_path = os.path.abspath(os.path.join(tracing_third_party_path, 'chai')) | 79 chai_path = os.path.abspath(os.path.join(tracing_third_party_path, 'chai')) |
| 80 mocha_path = os.path.abspath(os.path.join(tracing_third_party_path, 'mocha')) | 80 mocha_path = os.path.abspath(os.path.join(tracing_third_party_path, 'mocha')) |
| 81 | 81 |
| 82 test_data_path = os.path.join(tracing_root_path, 'test_data') | 82 test_data_path = os.path.join(tracing_root_path, 'test_data') |
| 83 skp_data_path = os.path.join(tracing_root_path, 'skp_data') | 83 skp_data_path = os.path.join(tracing_root_path, 'skp_data') |
| 84 | 84 |
| 85 rjsmin_path = os.path.abspath(os.path.join( | 85 rjsmin_path = os.path.abspath(os.path.join( |
| 86 tracing_third_party_path, 'tvcm', 'third_party', 'rjsmin')) | 86 py_vulcanize_path, 'third_party', 'rjsmin')) |
| 87 rcssmin_path = os.path.abspath(os.path.join( | 87 rcssmin_path = os.path.abspath(os.path.join( |
| 88 tracing_third_party_path, 'tvcm', 'third_party', 'rcssmin')) | 88 py_vulcanize_path, 'third_party', 'rcssmin')) |
| 89 | 89 |
| 90 def __init__(self): | 90 def __init__(self): |
| 91 self.source_paths = [] | 91 self.source_paths = [] |
| 92 self.source_paths.append(self.tracing_root_path) | 92 self.source_paths.append(self.tracing_root_path) |
| 93 self.source_paths.append(self.tracing_third_party_path) | 93 self.source_paths.append(self.tracing_third_party_path) |
| 94 self.source_paths.append(self.jszip_path) | 94 self.source_paths.append(self.jszip_path) |
| 95 self.source_paths.append(self.glmatrix_path) | 95 self.source_paths.append(self.glmatrix_path) |
| 96 self.source_paths.append(self.d3_path) | 96 self.source_paths.append(self.d3_path) |
| 97 self.source_paths.append(self.chai_path) | 97 self.source_paths.append(self.chai_path) |
| 98 self.source_paths.append(self.mocha_path) | 98 self.source_paths.append(self.mocha_path) |
| 99 | 99 |
| 100 def CreateVulcanizer(self): | 100 def CreateVulcanizer(self): |
| 101 from tvcm import project as project_module | 101 from py_vulcanize import project as project_module |
| 102 return project_module.Project(self.source_paths) | 102 return project_module.Project(self.source_paths) |
| 103 | 103 |
| 104 def IsD8CompatibleFile(self, filename): | 104 def IsD8CompatibleFile(self, filename): |
| 105 return not filename.startswith(self.ui_path) | 105 return not filename.startswith(self.ui_path) |
| 106 | 106 |
| 107 def FindAllTestModuleRelPaths(self, pred=None): | 107 def FindAllTestModuleRelPaths(self, pred=None): |
| 108 if pred is None: | 108 if pred is None: |
| 109 pred = lambda x: True | 109 pred = lambda x: True |
| 110 | 110 |
| 111 all_filenames = _FindAllFilesRecursive([self.tracing_src_path]) | 111 all_filenames = _FindAllFilesRecursive([self.tracing_src_path]) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 141 choices = self.GetConfigNames() | 141 choices = self.GetConfigNames() |
| 142 parser.add_argument( | 142 parser.add_argument( |
| 143 '--config', dest='config_name', | 143 '--config', dest='config_name', |
| 144 choices=choices, default=self.GetDefaultConfigName(), | 144 choices=choices, default=self.GetDefaultConfigName(), |
| 145 help='Picks a browser config. Valid choices: %s' % ', '.join(choices)) | 145 help='Picks a browser config. Valid choices: %s' % ', '.join(choices)) |
| 146 return choices | 146 return choices |
| 147 | 147 |
| 148 def GetModuleNameForConfigName(self, config_name): | 148 def GetModuleNameForConfigName(self, config_name): |
| 149 return 'tracing.ui.extras.%s_config' % config_name | 149 return 'tracing.ui.extras.%s_config' % config_name |
| 150 | 150 |
| OLD | NEW |