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") |
Antoine Pitrou | 71219da | 2011-02-25 14:31:09 +0000 | [diff] [blame] | 10 | line = inp.readline() |
Martin v. Löwis | 75aeaa9 | 2012-06-24 00:00:30 +0200 | [diff] [blame^] | 11 | while line.strip().startswith(';'): |
| 12 | line = inp.readline() |
| 13 | line = inp.readline() # LIBRARY |
Antoine Pitrou | 71219da | 2011-02-25 14:31:09 +0000 | [diff] [blame] | 14 | assert line.strip()=='EXPORTS' |
| 15 | |
| 16 | for line in inp: |
| 17 | # SYM1=python33.SYM2[ DATA] |
| 18 | head, tail = line.split('.') |
| 19 | if 'DATA' in tail: |
| 20 | symbol, tail = tail.split(' ') |
| 21 | else: |
| 22 | symbol = tail.strip() |
| 23 | out.write(symbol+'\n') |
| 24 | |
| 25 | inp.close() |
| 26 | out.close() |