Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 """ Generator for C style prototypes and definitions """ | 7 """ Generator for C style prototypes and definitions """ |
| 8 | 8 |
| 9 import glob | 9 import glob |
| 10 import os | 10 import os |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 release = releases[0] | 123 release = releases[0] |
| 124 def_guard = GetOutFileName(filenode, relpath=gpath) | 124 def_guard = GetOutFileName(filenode, relpath=gpath) |
| 125 def_guard = def_guard.replace(os.sep,'_').replace('.','_').upper() + '_' | 125 def_guard = def_guard.replace(os.sep,'_').replace('.','_').upper() + '_' |
| 126 | 126 |
| 127 cright_node = filenode.GetChildren()[0] | 127 cright_node = filenode.GetChildren()[0] |
| 128 assert(cright_node.IsA('Copyright')) | 128 assert(cright_node.IsA('Copyright')) |
| 129 fileinfo = filenode.GetChildren()[1] | 129 fileinfo = filenode.GetChildren()[1] |
| 130 assert(fileinfo.IsA('Comment')) | 130 assert(fileinfo.IsA('Comment')) |
| 131 | 131 |
| 132 out.Write('%s\n' % cgen.Copyright(cright_node)) | 132 out.Write('%s\n' % cgen.Copyright(cright_node)) |
| 133 out.Write('/* From %s modified %s. */\n\n'% ( | 133 |
| 134 filenode.GetProperty('NAME').replace(os.sep,'/'), | 134 # Wrap the From ... modified ... comment if it would be >80 characters. |
| 135 filenode.GetProperty('DATETIME'))) | 135 from_text = '/* From %s' % ( |
| 136 filenode.GetProperty('NAME').replace(os.sep,'/')) | |
| 137 modified_text = 'modified %s. */' % ( | |
| 138 filenode.GetProperty('DATETIME')) | |
| 139 if len(from_text) + len(modified_text) < 80: | |
| 140 out.Write('%s %s\n\n' % (from_text, modified_text)) | |
| 141 else: | |
| 142 out.Write('%s,\n * %s\n\n' % (from_text, modified_text)) | |
|
dmichael (off chromium)
2012/01/04 16:42:25
So this won't handle if the first part (the file n
| |
| 143 | |
| 136 out.Write('#ifndef %s\n#define %s\n\n' % (def_guard, def_guard)) | 144 out.Write('#ifndef %s\n#define %s\n\n' % (def_guard, def_guard)) |
| 137 # Generate set of includes | 145 # Generate set of includes |
| 138 | 146 |
| 139 deps = set() | 147 deps = set() |
| 140 for release in releases: | 148 for release in releases: |
| 141 deps |= filenode.GetDeps(release) | 149 deps |= filenode.GetDeps(release) |
| 142 | 150 |
| 143 includes = set([]) | 151 includes = set([]) |
| 144 for dep in deps: | 152 for dep in deps: |
| 145 depfile = dep.GetProperty('FILE') | 153 depfile = dep.GetProperty('FILE') |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 print "Golden file for M13-M15 failed." | 225 print "Golden file for M13-M15 failed." |
| 218 failed =1 | 226 failed =1 |
| 219 else: | 227 else: |
| 220 print "Golden file for M13-M15 passed." | 228 print "Golden file for M13-M15 passed." |
| 221 | 229 |
| 222 return failed | 230 return failed |
| 223 | 231 |
| 224 if __name__ == '__main__': | 232 if __name__ == '__main__': |
| 225 retval = Main(sys.argv[1:]) | 233 retval = Main(sys.argv[1:]) |
| 226 sys.exit(retval) | 234 sys.exit(retval) |
| OLD | NEW |