OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import optparse | 7 import optparse |
8 import os | 8 import os |
9 import re | 9 import re |
10 import shlex | 10 import shlex |
11 import subprocess | 11 import subprocess |
12 import sys | 12 import sys |
13 | 13 |
| 14 from pylib import cmd_helper |
14 from pylib import constants | 15 from pylib import constants |
15 | 16 |
16 | 17 |
17 def _PrintMessage(warnings, title, action, known_bugs_file): | 18 def _PrintMessage(warnings, title, action, known_bugs_file): |
18 if warnings: | 19 if warnings: |
19 print | 20 print |
20 print '*' * 80 | 21 print '*' * 80 |
21 print '%s warnings.' % title | 22 print '%s warnings.' % title |
22 print '%s %s' % (action, known_bugs_file) | 23 print '%s %s' % (action, known_bugs_file) |
23 print '-' * 80 | 24 print '-' * 80 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 print >>known_bugs, warning | 67 print >>known_bugs, warning |
67 return 0 | 68 return 0 |
68 | 69 |
69 | 70 |
70 def _GetChromeClasses(release_version): | 71 def _GetChromeClasses(release_version): |
71 version = 'Debug' | 72 version = 'Debug' |
72 if release_version: | 73 if release_version: |
73 version = 'Release' | 74 version = 'Release' |
74 path = os.path.join(constants.CHROME_DIR, 'out', version) | 75 path = os.path.join(constants.CHROME_DIR, 'out', version) |
75 cmd = 'find %s -name "*.class"' % path | 76 cmd = 'find %s -name "*.class"' % path |
76 proc = subprocess.Popen(shlex.split(cmd), | 77 out = cmd_helper.GetCmdOutput(shlex.split(cmd)) |
77 stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
78 out, err = proc.communicate() | |
79 | |
80 if not out: | 78 if not out: |
81 print 'No classes found in %s' % path | 79 print 'No classes found in %s' % path |
82 return out | 80 return out |
83 | 81 |
84 | 82 |
85 def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes, | 83 def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes, |
86 rebaseline, release_version, findbug_args): | 84 rebaseline, release_version, findbug_args): |
87 """Run the FindBugs. | 85 """Run the FindBugs. |
88 | 86 |
89 Args: | 87 Args: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 224 |
227 def main(argv): | 225 def main(argv): |
228 parser = GetCommonParser() | 226 parser = GetCommonParser() |
229 options, _ = parser.parse_args() | 227 options, _ = parser.parse_args() |
230 | 228 |
231 return Run(options) | 229 return Run(options) |
232 | 230 |
233 | 231 |
234 if __name__ == '__main__': | 232 if __name__ == '__main__': |
235 sys.exit(main(sys.argv)) | 233 sys.exit(main(sys.argv)) |
OLD | NEW |