Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d53ee5d

Browse files
committed
Automate build for python3.dll.
Package missing files.
1 parent f645b0e commit d53ee5d

6 files changed

Lines changed: 890 additions & 343 deletions

File tree

PC/python3.mak

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$(OutDir)python32.dll: python3.def $(OutDir)python32stub.lib
2+
cl /LD /Fe$(OutDir)python3.dll python3dll.c python3.def $(OutDir)python32stub.lib
3+
4+
$(OutDir)python32stub.lib: python32stub.def
5+
lib /def:python32stub.def /out:$(OutDir)python32stub.lib /MACHINE:$(MACHINE)
6+
7+
clean:
8+
del $(OutDir)python3.dll $(OutDir)python3.lib $(OutDir)python32stub.lib $(OutDir)python3.exp $(OutDir)python32stub.exp
9+
10+
rebuild: clean $(OutDir)python32.dll

PC/python32gen.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generate python32stub.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("python32stub.def", "w")
6+
out.write('LIBRARY "python32"\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=python32.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()
25+

0 commit comments

Comments
 (0)