Georg Brandl | 08a9012 | 2012-09-29 09:34:13 +0200 | [diff] [blame] | 1 | # Generate python34stub.def out of python3.def |
Antoine Pitrou | 71219da | 2011-02-25 14:31:09 +0000 | [diff] [blame] | 2 | # The regular import library cannot be used, |
| 3 | # since it doesn't provide the right symbols for |
| 4 | # data forwarding |
Georg Brandl | 08a9012 | 2012-09-29 09:34:13 +0200 | [diff] [blame] | 5 | out = open("python34stub.def", "w") |
| 6 | out.write('LIBRARY "python34"\n') |
Antoine Pitrou | 71219da | 2011-02-25 14:31:09 +0000 | [diff] [blame] | 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: |
Georg Brandl | 08a9012 | 2012-09-29 09:34:13 +0200 | [diff] [blame] | 17 | # SYM1=python34.SYM2[ DATA] |
Antoine Pitrou | 71219da | 2011-02-25 14:31:09 +0000 | [diff] [blame] | 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() |