Antoine Pitrou | 71219da | 2011-02-25 14:31:09 +0000 | [diff] [blame^] | 1 | # Generate python33stub.def out of python3.def |
| 2 | # The regular import library cannot be used, |
| 3 | # since it doesn't provide the right symbols for |
| 4 | # data forwarding |
| 5 | out = open("python33stub.def", "w") |
| 6 | out.write('LIBRARY "python33"\n') |
| 7 | out.write('EXPORTS\n') |
| 8 | |
| 9 | inp = open("python3.def") |
| 10 | inp.readline() |
| 11 | line = inp.readline() |
| 12 | assert line.strip()=='EXPORTS' |
| 13 | |
| 14 | for line in inp: |
| 15 | # SYM1=python33.SYM2[ DATA] |
| 16 | head, tail = line.split('.') |
| 17 | if 'DATA' in tail: |
| 18 | symbol, tail = tail.split(' ') |
| 19 | else: |
| 20 | symbol = tail.strip() |
| 21 | out.write(symbol+'\n') |
| 22 | |
| 23 | inp.close() |
| 24 | out.close() |