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') | 201 inputFile = open(inputFileName, 'r') |
Nils Barth (inactive)
2013/09/12 03:47:17
While you're here, could you remove the 'r', as i
kihong
2013/09/14 04:14:43
Done.
| |
202 idlFileNames = [] | 202 idlFileNames = [] |
203 cygdriveNames = [] | 203 cygdriveNames = [] |
204 for line in inputFile: | 204 for line in inputFile: |
205 if line.find('testing') != -1: | |
do-not-use
2013/09/11 12:54:24
I am not a fan of hardcoding such things in the sc
kihong
2013/09/14 04:14:43
I removed whole hardcoding things.
| |
206 continue | |
205 idlFileName = line.rstrip().split(' ')[0] | 207 idlFileName = line.rstrip().split(' ')[0] |
206 if idlFileName.startswith("/cygdrive"): | 208 if idlFileName.startswith("/cygdrive"): |
Nils Barth (inactive)
2013/09/12 03:47:17
Also, could you fix these quotes to single quotes?
kihong
2013/09/14 04:14:43
Done.
| |
207 cygdriveNames.append(idlFileName) | 209 cygdriveNames.append(idlFileName) |
208 else: | 210 else: |
209 idlFileNames.append(idlFileName) | 211 idlFileNames.append(idlFileName) |
210 | 212 |
211 if cygdriveNames: | 213 if cygdriveNames: |
212 idlFileNames.extend(resolveCygpath(cygdriveNames)) | 214 idlFileNames.extend(resolveCygpath(cygdriveNames)) |
213 inputFile.close() | 215 inputFile.close() |
214 | 216 |
215 filesMetaData = extractMetaData(idlFileNames) | 217 filesMetaData = extractMetaData(idlFileNames) |
216 for fileName in outputFileNames: | 218 for fileName in outputFileNames: |
217 partition = outputFileNames.index(fileName) | 219 partition = outputFileNames.index(fileName) |
218 fileContents = generateContent(filesMetaData, partition, len(outputFileN ames)) | 220 fileContents = generateContent(filesMetaData, partition, len(outputFileN ames)) |
219 writeContent(fileContents, fileName) | 221 writeContent(fileContents, fileName) |
220 | 222 |
221 return 0 | 223 return 0 |
222 | 224 |
223 | 225 |
224 if __name__ == '__main__': | 226 if __name__ == '__main__': |
225 sys.exit(main(sys.argv)) | 227 sys.exit(main(sys.argv)) |
OLD | NEW |