| 1 | n/a | # Generate python34stub.def out of python3.def |
|---|
| 2 | n/a | # The regular import library cannot be used, |
|---|
| 3 | n/a | # since it doesn't provide the right symbols for |
|---|
| 4 | n/a | # data forwarding |
|---|
| 5 | n/a | out = open("python34stub.def", "w") |
|---|
| 6 | n/a | out.write('LIBRARY "python34"\n') |
|---|
| 7 | n/a | out.write('EXPORTS\n') |
|---|
| 8 | n/a | |
|---|
| 9 | n/a | inp = open("python3.def") |
|---|
| 10 | n/a | line = inp.readline() |
|---|
| 11 | n/a | while line.strip().startswith(';'): |
|---|
| 12 | n/a | line = inp.readline() |
|---|
| 13 | n/a | line = inp.readline() # LIBRARY |
|---|
| 14 | n/a | assert line.strip()=='EXPORTS' |
|---|
| 15 | n/a | |
|---|
| 16 | n/a | for line in inp: |
|---|
| 17 | n/a | # SYM1=python34.SYM2[ DATA] |
|---|
| 18 | n/a | head, tail = line.split('.') |
|---|
| 19 | n/a | if 'DATA' in tail: |
|---|
| 20 | n/a | symbol, tail = tail.split(' ') |
|---|
| 21 | n/a | else: |
|---|
| 22 | n/a | symbol = tail.strip() |
|---|
| 23 | n/a | out.write(symbol+'\n') |
|---|
| 24 | n/a | |
|---|
| 25 | n/a | inp.close() |
|---|
| 26 | n/a | out.close() |
|---|