copy lines from in file to out file up to first occurance of the string 'org.apache.axis', then just write closing brace. hasAxisCode detects of the file was already processed such that this is an idempotent operation.
(fileName)
| 15 | """ |
| 16 | |
| 17 | def stripAxisCode(fileName): |
| 18 | """copy lines from in file to out file up to first occurance |
| 19 | of the string 'org.apache.axis', then just write closing brace. |
| 20 | hasAxisCode detects of the file was already processed such that |
| 21 | this is an idempotent operation. |
| 22 | """ |
| 23 | hasAxisCode = False |
| 24 | fin = open(fileName, 'r') |
| 25 | outName = ''.join([fileName, '.tmp']) |
| 26 | fout = open(outName, 'wr') |
| 27 | for line in fin: |
| 28 | if (string.find(line, 'org.apache.axis') != -1 and |
| 29 | string.find(line, 'extends') == -1 and |
| 30 | string.find(line, 'implements') == -1): |
| 31 | hasAxisCode = True |
| 32 | break |
| 33 | else: |
| 34 | fout.write(line) |
| 35 | |
| 36 | fin.close() |
| 37 | if hasAxisCode: |
| 38 | fout.write("}\n") |
| 39 | fout.close |
| 40 | shutil.move(outName, fileName) |
| 41 | |
| 42 | def processDirTree(tld): |
| 43 | """From the top level package dir of Axis-generated POJOs, |