| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 self._env_path = os.environ['PATH'].split(os.pathsep) | 80 self._env_path = os.environ['PATH'].split(os.pathsep) |
| 81 self._webkit_base = None | 81 self._webkit_base = None |
| 82 self._chromium_base = None | 82 self._chromium_base = None |
| 83 self._depot_tools = None | 83 self._depot_tools = None |
| 84 | 84 |
| 85 def webkit_base(self): | 85 def webkit_base(self): |
| 86 """Returns the absolute path to the top of the WebKit tree. | 86 """Returns the absolute path to the top of the WebKit tree. |
| 87 | 87 |
| 88 Raises an AssertionError if the top dir can't be determined. | 88 Raises an AssertionError if the top dir can't be determined. |
| 89 """ | 89 """ |
| 90 # Note: This code somewhat duplicates the code in | 90 # TODO(qyearsley): This code somewhat duplicates the code in |
| 91 # git.find_checkout_root(). However, that code only works if the top | 91 # git.find_checkout_root(). |
| 92 # of the SCM repository also matches the top of the WebKit tree. Some SV
N users | |
| 93 # (the chromium test bots, for example), might only check out subdirecto
ries like | |
| 94 # Tools/Scripts. This code will also work if there is no SCM system at a
ll. | |
| 95 # TODO(qyearsley): Remove duplicate code; we're not concerned with SVN u
sers anymore. | |
| 96 # Also, instead of caching the result with a private instance variable,
we can use | |
| 97 # the memoized decorator. | |
| 98 if not self._webkit_base: | 92 if not self._webkit_base: |
| 99 self._webkit_base = self._webkit_base | 93 self._webkit_base = self._webkit_base |
| 100 module_path = self._filesystem.abspath(self._filesystem.path_to_modu
le(self.__module__)) | 94 module_path = self._filesystem.abspath(self._filesystem.path_to_modu
le(self.__module__)) |
| 101 tools_index = module_path.rfind('Tools') | 95 tools_index = module_path.rfind('Tools') |
| 102 assert tools_index != -1, 'could not find location of this checkout
from %s' % module_path | 96 assert tools_index != -1, 'could not find location of this checkout
from %s' % module_path |
| 103 self._webkit_base = self._filesystem.normpath(module_path[0:tools_in
dex - 1]) | 97 self._webkit_base = self._filesystem.normpath(module_path[0:tools_in
dex - 1]) |
| 104 return self._webkit_base | 98 return self._webkit_base |
| 105 | 99 |
| 106 def chromium_base(self): | 100 def chromium_base(self): |
| 107 if not self._chromium_base: | 101 if not self._chromium_base: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 prev_dir = '' | 163 prev_dir = '' |
| 170 current_dir = fs.dirname(self._webkit_base) | 164 current_dir = fs.dirname(self._webkit_base) |
| 171 while current_dir != prev_dir: | 165 while current_dir != prev_dir: |
| 172 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): | 166 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): |
| 173 return fs.join(current_dir, 'depot_tools') | 167 return fs.join(current_dir, 'depot_tools') |
| 174 prev_dir = current_dir | 168 prev_dir = current_dir |
| 175 current_dir = fs.dirname(current_dir) | 169 current_dir = fs.dirname(current_dir) |
| 176 | 170 |
| 177 def path_from_depot_tools_base(self, *comps): | 171 def path_from_depot_tools_base(self, *comps): |
| 178 return self._filesystem.join(self.depot_tools_base(), *comps) | 172 return self._filesystem.join(self.depot_tools_base(), *comps) |
| OLD | NEW |