blob: 180ce11fd28bea4ca900f00b5f54dba5c3d43b9f [file] [log] [blame]
Georg Brandl08a90122012-09-29 09:34:13 +02001# Generate python34stub.def out of python3.def
Antoine Pitrou71219da2011-02-25 14:31:09 +00002# The regular import library cannot be used,
3# since it doesn't provide the right symbols for
4# data forwarding
Georg Brandl08a90122012-09-29 09:34:13 +02005out = open("python34stub.def", "w")
6out.write('LIBRARY "python34"\n')
Antoine Pitrou71219da2011-02-25 14:31:09 +00007out.write('EXPORTS\n')
8
9inp = open("python3.def")
Antoine Pitrou71219da2011-02-25 14:31:09 +000010line = inp.readline()
Martin v. Löwis75aeaa92012-06-24 00:00:30 +020011while line.strip().startswith(';'):
12 line = inp.readline()
13line = inp.readline() # LIBRARY
Antoine Pitrou71219da2011-02-25 14:31:09 +000014assert line.strip()=='EXPORTS'
15
16for line in inp:
Georg Brandl08a90122012-09-29 09:34:13 +020017 # SYM1=python34.SYM2[ DATA]
Antoine Pitrou71219da2011-02-25 14:31:09 +000018 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
25inp.close()
26out.close()