OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Script to regenerate API docs using doxygen. | 6 """Script to regenerate API docs using doxygen. |
7 """ | 7 """ |
8 | 8 |
9 import argparse | 9 import argparse |
10 import collections | 10 import collections |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 with open(template_filename) as f: | 193 with open(template_filename) as f: |
194 data = f.read() | 194 data = f.read() |
195 | 195 |
196 with open(doxyfile, 'w') as f: | 196 with open(doxyfile, 'w') as f: |
197 f.write(data % { | 197 f.write(data % { |
198 'out_dirname': out_dirname, | 198 'out_dirname': out_dirname, |
199 'doc_dirname': doc_dirname, | 199 'doc_dirname': doc_dirname, |
200 'script_dirname': SCRIPT_DIR}) | 200 'script_dirname': SCRIPT_DIR}) |
201 | 201 |
202 | 202 |
| 203 def CheckDoxygenVersion(doxygen): |
| 204 version = subprocess.check_output([doxygen, '--version']).strip() |
| 205 url = 'http://ftp.stack.nl/pub/users/dimitri/doxygen-1.7.6.1.linux.bin.tar.gz' |
| 206 if version != '1.7.6.1': |
| 207 print 'Doxygen version 1.7.6.1 is required' |
| 208 print 'The version being used (%s) is version %s' % (doxygen, version) |
| 209 print 'The simplest way to grab this version is to download it directly:' |
| 210 print url |
| 211 print 'Then either add it to your $PATH or set $DOXYGEN to point to binary.' |
| 212 sys.exit(1) |
| 213 |
| 214 |
203 def RunDoxygen(out_dirname, doxyfile): | 215 def RunDoxygen(out_dirname, doxyfile): |
204 Trace('Removing old output directory %s' % out_dirname) | 216 Trace('Removing old output directory %s' % out_dirname) |
205 RemoveDir(out_dirname) | 217 RemoveDir(out_dirname) |
206 | 218 |
207 Trace('Making new output directory %s' % out_dirname) | 219 Trace('Making new output directory %s' % out_dirname) |
208 os.makedirs(out_dirname) | 220 os.makedirs(out_dirname) |
209 | 221 |
210 doxygen = os.environ.get('DOXYGEN', 'doxygen') | 222 doxygen = os.environ.get('DOXYGEN', 'doxygen') |
| 223 CheckDoxygenVersion(doxygen) |
211 cmd = [doxygen, doxyfile] | 224 cmd = [doxygen, doxyfile] |
212 Trace('Running Doxygen:\n %s' % ' '.join(cmd)) | 225 Trace('Running Doxygen:\n %s' % ' '.join(cmd)) |
213 subprocess.check_call(cmd) | 226 subprocess.check_call(cmd) |
214 | 227 |
215 | 228 |
216 def RunDoxyCleanup(out_dirname): | 229 def RunDoxyCleanup(out_dirname): |
217 script = os.path.join(SCRIPT_DIR, 'doxy_cleanup.py') | 230 script = os.path.join(SCRIPT_DIR, 'doxy_cleanup.py') |
218 cmd = [sys.executable, script, out_dirname] | 231 cmd = [sys.executable, script, out_dirname] |
219 if Trace.verbose: | 232 if Trace.verbose: |
220 cmd.append('-v') | 233 cmd.append('-v') |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 return 0 | 320 return 0 |
308 | 321 |
309 | 322 |
310 if __name__ == '__main__': | 323 if __name__ == '__main__': |
311 try: | 324 try: |
312 rtn = main(sys.argv[1:]) | 325 rtn = main(sys.argv[1:]) |
313 except KeyboardInterrupt: | 326 except KeyboardInterrupt: |
314 sys.stderr.write('%s: interrupted\n' % os.path.basename(__file__)) | 327 sys.stderr.write('%s: interrupted\n' % os.path.basename(__file__)) |
315 rtn = 1 | 328 rtn = 1 |
316 sys.exit(rtn) | 329 sys.exit(rtn) |
OLD | NEW |