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 26 matching lines...) Expand all Loading... |
37 self._dirsep = filesystem.sep | 37 self._dirsep = filesystem.sep |
38 self._sys_path = sys.path | 38 self._sys_path = sys.path |
39 self._env_path = os.environ['PATH'].split(os.pathsep) | 39 self._env_path = os.environ['PATH'].split(os.pathsep) |
40 self._webkit_base = None | 40 self._webkit_base = None |
41 self._chromium_base = None | 41 self._chromium_base = None |
42 self._depot_tools = None | 42 self._depot_tools = None |
43 | 43 |
44 def webkit_base(self): | 44 def webkit_base(self): |
45 """Returns the absolute path to the top of the WebKit tree. | 45 """Returns the absolute path to the top of the WebKit tree. |
46 | 46 |
47 Raises an AssertionError if the top dir can't be determined.""" | 47 Raises an AssertionError if the top dir can't be determined. |
| 48 """ |
48 # Note: This code somewhat duplicates the code in | 49 # Note: This code somewhat duplicates the code in |
49 # scm.find_checkout_root(). However, that code only works if the top | 50 # scm.find_checkout_root(). However, that code only works if the top |
50 # of the SCM repository also matches the top of the WebKit tree. Some SV
N users | 51 # of the SCM repository also matches the top of the WebKit tree. Some SV
N users |
51 # (the chromium test bots, for example), might only check out subdirecto
ries like | 52 # (the chromium test bots, for example), might only check out subdirecto
ries like |
52 # Tools/Scripts. This code will also work if there is no SCM system at a
ll. | 53 # Tools/Scripts. This code will also work if there is no SCM system at a
ll. |
53 # TODO(qyearsley): Remove duplicate code; we're not concerned with SVN u
sers anymore. | 54 # TODO(qyearsley): Remove duplicate code; we're not concerned with SVN u
sers anymore. |
54 # Also, instead of caching the result with a private instance variable,
we can use | 55 # Also, instead of caching the result with a private instance variable,
we can use |
55 # the memoized decorator. | 56 # the memoized decorator. |
56 if not self._webkit_base: | 57 if not self._webkit_base: |
57 self._webkit_base = self._webkit_base | 58 self._webkit_base = self._webkit_base |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 prev_dir = '' | 122 prev_dir = '' |
122 current_dir = fs.dirname(self._webkit_base) | 123 current_dir = fs.dirname(self._webkit_base) |
123 while current_dir != prev_dir: | 124 while current_dir != prev_dir: |
124 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): | 125 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): |
125 return fs.join(current_dir, 'depot_tools') | 126 return fs.join(current_dir, 'depot_tools') |
126 prev_dir = current_dir | 127 prev_dir = current_dir |
127 current_dir = fs.dirname(current_dir) | 128 current_dir = fs.dirname(current_dir) |
128 | 129 |
129 def path_from_depot_tools_base(self, *comps): | 130 def path_from_depot_tools_base(self, *comps): |
130 return self._filesystem.join(self.depot_tools_base(), *comps) | 131 return self._filesystem.join(self.depot_tools_base(), *comps) |
OLD | NEW |