| 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: |
| 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'): |
| 208 else: | 207 cygdriveNames.append(idlFileName) |
| 209 idlFileNames.append(idlFileName) | 208 else: |
| 209 idlFileNames.append(idlFileName) |
| 210 inputFile.close() |
| 210 | 211 |
| 211 if cygdriveNames: | 212 if cygdriveNames: |
| 212 idlFileNames.extend(resolveCygpath(cygdriveNames)) | 213 idlFileNames.extend(resolveCygpath(cygdriveNames)) |
| 213 inputFile.close() | |
| 214 | 214 |
| 215 filesMetaData = extractMetaData(idlFileNames) | 215 filesMetaData = extractMetaData(idlFileNames) |
| 216 for fileName in outputFileNames: | 216 for fileName in outputFileNames: |
| 217 partition = outputFileNames.index(fileName) | 217 partition = outputFileNames.index(fileName) |
| 218 fileContents = generateContent(filesMetaData, partition, len(outputFileN
ames)) | 218 fileContents = generateContent(filesMetaData, partition, len(outputFileN
ames)) |
| 219 writeContent(fileContents, fileName) | 219 writeContent(fileContents, fileName) |
| 220 | 220 |
| 221 return 0 | 221 return 0 |
| 222 | 222 |
| 223 | 223 |
| 224 if __name__ == '__main__': | 224 if __name__ == '__main__': |
| 225 sys.exit(main(sys.argv)) | 225 sys.exit(main(sys.argv)) |
| OLD | NEW |