4 # Write the config.c file
6 never
= ['marshal', '__main__', '__builtin__', 'sys']
8 def makeconfig(infp
, outfp
, modules
):
9 m1
= regex
.compile('-- ADDMODULE MARKER 1 --')
10 m2
= regex
.compile('-- ADDMODULE MARKER 2 --')
12 line
= infp
.readline()
15 if m1
and m1
.search(line
) >= 0:
20 outfp
.write('extern void init%s();\n' % mod
)
21 elif m2
and m2
.search(line
) >= 0:
26 outfp
.write('\t{"%s", init%s},\n' %
29 sys
.stderr
.write('MARKER 1 never found\n')
31 sys
.stderr
.write('MARKER 2 never found\n')
39 print 'usage: python makeconfig.py config.c.in outputfile',
40 print 'modulename ...'
42 if sys
.argv
[1] == '-':
45 infp
= open(sys
.argv
[1])
46 if sys
.argv
[2] == '-':
49 outfp
= open(sys
.argv
[2], 'w')
50 makeconfig(infp
, outfp
, sys
.argv
[3:])
51 if outfp
!= sys
.stdout
:
56 if __name__
== '__main__':