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 13 matching lines...) Expand all Loading... |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 import os | 29 import os |
30 import sys | 30 import sys |
31 | 31 |
32 | 32 |
33 class WebKitFinder(object): | 33 class WebKitFinder(object): |
| 34 |
34 def __init__(self, filesystem): | 35 def __init__(self, filesystem): |
35 self._filesystem = filesystem | 36 self._filesystem = filesystem |
36 self._dirsep = filesystem.sep | 37 self._dirsep = filesystem.sep |
37 self._sys_path = sys.path | 38 self._sys_path = sys.path |
38 self._env_path = os.environ['PATH'].split(os.pathsep) | 39 self._env_path = os.environ['PATH'].split(os.pathsep) |
39 self._webkit_base = None | 40 self._webkit_base = None |
40 self._chromium_base = None | 41 self._chromium_base = None |
41 self._depot_tools = None | 42 self._depot_tools = None |
42 | 43 |
43 def webkit_base(self): | 44 def webkit_base(self): |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 prev_dir = '' | 101 prev_dir = '' |
101 current_dir = fs.dirname(self._webkit_base) | 102 current_dir = fs.dirname(self._webkit_base) |
102 while current_dir != prev_dir: | 103 while current_dir != prev_dir: |
103 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): | 104 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): |
104 return fs.join(current_dir, 'depot_tools') | 105 return fs.join(current_dir, 'depot_tools') |
105 prev_dir = current_dir | 106 prev_dir = current_dir |
106 current_dir = fs.dirname(current_dir) | 107 current_dir = fs.dirname(current_dir) |
107 | 108 |
108 def path_from_depot_tools_base(self, *comps): | 109 def path_from_depot_tools_base(self, *comps): |
109 return self._filesystem.join(self.depot_tools_base(), *comps) | 110 return self._filesystem.join(self.depot_tools_base(), *comps) |
OLD | NEW |