| OLD | NEW |
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 tools_index = module_path.rfind('Tools') | 98 tools_index = module_path.rfind('Tools') |
| 99 assert tools_index != -1, 'could not find location of this checkout
from %s' % module_path | 99 assert tools_index != -1, 'could not find location of this checkout
from %s' % module_path |
| 100 self._webkit_base = self._filesystem.normpath(module_path[0:tools_in
dex - 1]) | 100 self._webkit_base = self._filesystem.normpath(module_path[0:tools_in
dex - 1]) |
| 101 return self._webkit_base | 101 return self._webkit_base |
| 102 | 102 |
| 103 def chromium_base(self): | 103 def chromium_base(self): |
| 104 if not self._chromium_base: | 104 if not self._chromium_base: |
| 105 self._chromium_base = self._filesystem.dirname(self._filesystem.dirn
ame(self.webkit_base())) | 105 self._chromium_base = self._filesystem.dirname(self._filesystem.dirn
ame(self.webkit_base())) |
| 106 return self._chromium_base | 106 return self._chromium_base |
| 107 | 107 |
| 108 # TODO(tkent): Make this private. We should use functions for | 108 # Do not expose this function in order to make the code robust against |
| 109 # sub-directories in order to make the code robust against directory | 109 # directory structure changes. |
| 110 # structure changes. | 110 def _path_from_webkit_base(self, *comps): |
| 111 def path_from_webkit_base(self, *comps): | |
| 112 return self._filesystem.join(self.webkit_base(), *comps) | 111 return self._filesystem.join(self.webkit_base(), *comps) |
| 113 | 112 |
| 114 def path_from_chromium_base(self, *comps): | 113 def path_from_chromium_base(self, *comps): |
| 115 return self._filesystem.join(self.chromium_base(), *comps) | 114 return self._filesystem.join(self.chromium_base(), *comps) |
| 116 | 115 |
| 117 def path_from_blink_source(self, *comps): | 116 def path_from_blink_source(self, *comps): |
| 118 return self._filesystem.join(self._filesystem.join(self.webkit_base(), '
Source'), *comps) | 117 return self._filesystem.join(self._filesystem.join(self.webkit_base(), '
Source'), *comps) |
| 119 | 118 |
| 120 def path_to_script(self, script_name): | 119 def path_to_script(self, script_name): |
| 121 """Returns the relative path to the script from the top of the WebKit tr
ee.""" | 120 """Returns the relative path to the script from the top of the WebKit tr
ee.""" |
| 122 # This is intentionally relative in order to force callers to consider w
hat | 121 # This is intentionally relative in order to force callers to consider w
hat |
| 123 # their current working directory is (and change to the top of the tree
if necessary). | 122 # their current working directory is (and change to the top of the tree
if necessary). |
| 124 return self._filesystem.join('Tools', 'Scripts', script_name) | 123 return self._filesystem.join('Tools', 'Scripts', script_name) |
| 125 | 124 |
| 126 def path_from_tools_scripts(self, *comps): | 125 def path_from_tools_scripts(self, *comps): |
| 127 return self._filesystem.join(self._filesystem.join(self.webkit_base(), '
Tools', 'Scripts'), *comps) | 126 return self._filesystem.join(self._filesystem.join(self.webkit_base(), '
Tools', 'Scripts'), *comps) |
| 128 | 127 |
| 129 def layout_tests_dir(self): | 128 def layout_tests_dir(self): |
| 130 return self.path_from_webkit_base('LayoutTests') | 129 return self._path_from_webkit_base('LayoutTests') |
| 131 | 130 |
| 132 def path_from_layout_tests(self, *comps): | 131 def path_from_layout_tests(self, *comps): |
| 133 return self._filesystem.join(self.layout_tests_dir(), *comps) | 132 return self._filesystem.join(self.layout_tests_dir(), *comps) |
| 134 | 133 |
| 135 def perf_tests_dir(self): | 134 def perf_tests_dir(self): |
| 136 return self.path_from_webkit_base('PerformanceTests') | 135 return self._path_from_webkit_base('PerformanceTests') |
| 137 | 136 |
| 138 def layout_test_name(self, file_path): | 137 def layout_test_name(self, file_path): |
| 139 """Returns a layout test name, given the path from the repo root. | 138 """Returns a layout test name, given the path from the repo root. |
| 140 | 139 |
| 141 Note: this appears to not work on Windows; see crbug.com/658795. | 140 Note: this appears to not work on Windows; see crbug.com/658795. |
| 142 Also, this function duplicates functionality that's in | 141 Also, this function duplicates functionality that's in |
| 143 Port.relative_test_filename. | 142 Port.relative_test_filename. |
| 144 TODO(qyearsley): De-duplicate this and Port.relative_test_filename, | 143 TODO(qyearsley): De-duplicate this and Port.relative_test_filename, |
| 145 and ensure that it works properly with Windows paths. | 144 and ensure that it works properly with Windows paths. |
| 146 | 145 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 prev_dir = '' | 177 prev_dir = '' |
| 179 current_dir = fs.dirname(self._webkit_base) | 178 current_dir = fs.dirname(self._webkit_base) |
| 180 while current_dir != prev_dir: | 179 while current_dir != prev_dir: |
| 181 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): | 180 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): |
| 182 return fs.join(current_dir, 'depot_tools') | 181 return fs.join(current_dir, 'depot_tools') |
| 183 prev_dir = current_dir | 182 prev_dir = current_dir |
| 184 current_dir = fs.dirname(current_dir) | 183 current_dir = fs.dirname(current_dir) |
| 185 | 184 |
| 186 def path_from_depot_tools_base(self, *comps): | 185 def path_from_depot_tools_base(self, *comps): |
| 187 return self._filesystem.join(self.depot_tools_base(), *comps) | 186 return self._filesystem.join(self.depot_tools_base(), *comps) |
| OLD | NEW |