Chromium Code Reviews| Index: clang_format.py |
| diff --git a/clang_format.py b/clang_format.py |
| index 27539f86da08e0a37a2cde8e6638340797b6b608..1c5b76be82ff98a67c6afbd24ca2d97d88947405 100755 |
| --- a/clang_format.py |
| +++ b/clang_format.py |
| @@ -23,19 +23,22 @@ class NotFoundError(Exception): |
| ' %s' % e) |
| -def _FindChromiumTree(): |
| - """Return the root of the current chromium checkout, or die trying.""" |
| - source_root = gclient_utils.FindFileUpwards('.gclient') |
| +def _FindChromiumSourceRoot(): |
| + """Return the source root of the current chromium checkout, or die trying.""" |
| + # The use of .gn is somewhat incongruous here, but we need a file uniquely |
| + # existing at src/. GN does the same thing at least. |
| + source_root = gclient_utils.FindFileUpwards('.gn') |
|
ajm
2014/01/28 01:54:31
I at first wanted to use .clang-format here, but n
ncarter (slow)
2014/01/30 00:35:06
I think .gn is the best of our currently available
|
| if not source_root: |
| raise NotFoundError( |
| - '.gclient file not found in any parent of the current path.') |
| + '.gn file not found in any parent of the current path.') |
| return source_root |
| def FindClangFormatToolInChromiumTree(): |
| """Return a path to the clang-format executable, or die trying.""" |
| - # The binaries in platform-specific subdirectories in src/tools/gn/bin. |
| - tool_path = os.path.join(_FindChromiumTree(), 'src', 'third_party', |
| + # The binaries in platform-specific subdirectories in |
| + # third_party/clang_format/bin. |
| + tool_path = os.path.join(_FindChromiumSourceRoot(), 'third_party', |
| 'clang_format', 'bin', |
| gclient_utils.GetMacWinOrLinux(), |
| 'clang-format' + gclient_utils.GetExeSuffix()) |
| @@ -62,8 +65,9 @@ def FindClangFormatToolInChromiumTree(): |
| def FindClangFormatScriptInChromiumTree(script_name): |
| """Return a path to a clang-format helper script, or die trying.""" |
| - # The binaries in platform-specific subdirectories in src/tools/gn/bin. |
| - script_path = os.path.join(_FindChromiumTree(), 'src', 'third_party', |
| + # The binaries in platform-specific subdirectories in |
| + # third_party/clang_format/bin. |
|
ncarter (slow)
2014/01/30 00:35:06
oof, thanks for fixing these comments.
|
| + script_path = os.path.join(_FindChromiumSourceRoot(), 'third_party', |
| 'clang_format', 'scripts', script_name) |
| if not os.path.exists(script_path): |
| raise NotFoundError('File does not exist: %s' % script_path) |