4 # Write the config.c file
6 never
= ['marshal', '__main__', '__builtin__', 'sys', 'exceptions']
8 def makeconfig(infp
, outfp
, modules
, with_ifdef
=0):
9 m1
= re
.compile('-- ADDMODULE MARKER 1 --')
10 m2
= re
.compile('-- ADDMODULE MARKER 2 --')
12 line
= infp
.readline()
15 if m1
and m1
.search(line
):
21 outfp
.write("#ifndef init%s\n"%mod
)
22 outfp
.write('extern void init%s(void);\n' % mod
)
24 outfp
.write("#endif\n")
25 elif m2
and m2
.search(line
):
30 outfp
.write('\t{"%s", init%s},\n' %
33 sys
.stderr
.write('MARKER 1 never found\n')
35 sys
.stderr
.write('MARKER 2 never found\n')
43 print 'usage: python makeconfig.py config.c.in outputfile',
44 print 'modulename ...'
46 if sys
.argv
[1] == '-':
49 infp
= open(sys
.argv
[1])
50 if sys
.argv
[2] == '-':
53 outfp
= open(sys
.argv
[2], 'w')
54 makeconfig(infp
, outfp
, sys
.argv
[3:])
55 if outfp
!= sys
.stdout
:
60 if __name__
== '__main__':