| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return self._filesystem.join("Tools", "Scripts", script_name) | 75 return self._filesystem.join("Tools", "Scripts", script_name) |
| 76 | 76 |
| 77 def layout_tests_dir(self): | 77 def layout_tests_dir(self): |
| 78 return self.path_from_webkit_base('LayoutTests') | 78 return self.path_from_webkit_base('LayoutTests') |
| 79 | 79 |
| 80 def perf_tests_dir(self): | 80 def perf_tests_dir(self): |
| 81 return self.path_from_webkit_base('PerformanceTests') | 81 return self.path_from_webkit_base('PerformanceTests') |
| 82 | 82 |
| 83 def depot_tools_base(self): | 83 def depot_tools_base(self): |
| 84 if not self._depot_tools: | 84 if not self._depot_tools: |
| 85 # This basically duplicates src/tools/find_depot_tools.py without th
e side effects | 85 # This basically duplicates src/build/find_depot_tools.py without th
e side effects |
| 86 # (adding the directory to sys.path and importing breakpad). | 86 # (adding the directory to sys.path and importing breakpad). |
| 87 self._depot_tools = (self._check_paths_for_depot_tools(self._sys_pat
h) or | 87 self._depot_tools = (self._check_paths_for_depot_tools(self._sys_pat
h) or |
| 88 self._check_paths_for_depot_tools(self._env_pat
h) or | 88 self._check_paths_for_depot_tools(self._env_pat
h) or |
| 89 self._check_upward_for_depot_tools()) | 89 self._check_upward_for_depot_tools()) |
| 90 return self._depot_tools | 90 return self._depot_tools |
| 91 | 91 |
| 92 def _check_paths_for_depot_tools(self, paths): | 92 def _check_paths_for_depot_tools(self, paths): |
| 93 for path in paths: | 93 for path in paths: |
| 94 if path.rstrip(self._dirsep).endswith('depot_tools'): | 94 if path.rstrip(self._dirsep).endswith('depot_tools'): |
| 95 return path | 95 return path |
| 96 return None | 96 return None |
| 97 | 97 |
| 98 def _check_upward_for_depot_tools(self): | 98 def _check_upward_for_depot_tools(self): |
| 99 fs = self._filesystem | 99 fs = self._filesystem |
| 100 prev_dir = '' | 100 prev_dir = '' |
| 101 current_dir = fs.dirname(self._webkit_base) | 101 current_dir = fs.dirname(self._webkit_base) |
| 102 while current_dir != prev_dir: | 102 while current_dir != prev_dir: |
| 103 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): | 103 if fs.exists(fs.join(current_dir, 'depot_tools', 'pylint.py')): |
| 104 return fs.join(current_dir, 'depot_tools') | 104 return fs.join(current_dir, 'depot_tools') |
| 105 prev_dir = current_dir | 105 prev_dir = current_dir |
| 106 current_dir = fs.dirname(current_dir) | 106 current_dir = fs.dirname(current_dir) |
| 107 | 107 |
| 108 def path_from_depot_tools_base(self, *comps): | 108 def path_from_depot_tools_base(self, *comps): |
| 109 return self._filesystem.join(self.depot_tools_base(), *comps) | 109 return self._filesystem.join(self.depot_tools_base(), *comps) |
| OLD | NEW |