OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (C) 2009 Google Inc. All rights reserved. | 3 # Copyright (C) 2009 Google Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 process.wait() | 191 process.wait() |
192 return idlFileNames | 192 return idlFileNames |
193 | 193 |
194 | 194 |
195 def main(args): | 195 def main(args): |
196 assert(len(args) > 3) | 196 assert(len(args) > 3) |
197 inOutBreakIndex = args.index('--') | 197 inOutBreakIndex = args.index('--') |
198 inputFileName = args[1] | 198 inputFileName = args[1] |
199 outputFileNames = args[inOutBreakIndex+1:] | 199 outputFileNames = args[inOutBreakIndex+1:] |
200 | 200 |
201 inputFile = open(inputFileName, 'r') | |
202 idlFileNames = [] | 201 idlFileNames = [] |
203 cygdriveNames = [] | 202 cygdriveNames = [] |
204 for line in inputFile: | 203 with open(inputFileName) as inputFile: |
eseidel
2013/10/10 06:08:37
Woh, cxrazy this is no pep8, but I guess chromium
Nils Barth (inactive)
2013/10/10 06:17:34
Nono, you're right, this should be under_scores:
h
Nils Barth (inactive)
2013/10/10 08:51:02
Python style (and bug fix!) for this file addresse
| |
205 idlFileName = line.rstrip().split(' ')[0] | 204 for line in inputFile: |
206 if idlFileName.startswith("/cygdrive"): | 205 idlFileName = line.rstrip() |
207 cygdriveNames.append(idlFileName) | 206 if idlFileName.startswith('/cygdrive'): |
eseidel
2013/10/10 06:08:37
Bleh. Filesystem abstractions ftw.
| |
208 else: | 207 cygdriveNames.append(idlFileName) |
209 idlFileNames.append(idlFileName) | 208 else: |
209 idlFileNames.append(idlFileName) | |
210 | 210 |
211 if cygdriveNames: | 211 if cygdriveNames: |
212 idlFileNames.extend(resolveCygpath(cygdriveNames)) | 212 idlFileNames.extend(resolveCygpath(cygdriveNames)) |
213 inputFile.close() | |
214 | 213 |
215 filesMetaData = extractMetaData(idlFileNames) | 214 filesMetaData = extractMetaData(idlFileNames) |
216 for fileName in outputFileNames: | 215 for fileName in outputFileNames: |
217 partition = outputFileNames.index(fileName) | 216 partition = outputFileNames.index(fileName) |
218 fileContents = generateContent(filesMetaData, partition, len(outputFileN ames)) | 217 fileContents = generateContent(filesMetaData, partition, len(outputFileN ames)) |
219 writeContent(fileContents, fileName) | 218 writeContent(fileContents, fileName) |
220 | 219 |
221 return 0 | 220 return 0 |
222 | 221 |
223 | 222 |
224 if __name__ == '__main__': | 223 if __name__ == '__main__': |
225 sys.exit(main(sys.argv)) | 224 sys.exit(main(sys.argv)) |
OLD | NEW |