MCPcopy Index your code
hub / github.com/python/cpython / makeconfig

Function makeconfig

Tools/freeze/makeconfig.py:9–34  ·  view source on GitHub ↗
(infp, outfp, modules, with_ifdef=0)

Source from the content-addressed store, hash-verified

7 'sys', 'gc', '_warnings']
8
9def makeconfig(infp, outfp, modules, with_ifdef=0):
10 m1 = re.compile('-- ADDMODULE MARKER 1 --')
11 m2 = re.compile('-- ADDMODULE MARKER 2 --')
12 for line in infp:
13 outfp.write(line)
14 if m1 and m1.search(line):
15 m1 = None
16 for mod in modules:
17 if mod in never:
18 continue
19 if with_ifdef:
20 outfp.write("#ifndef PyInit_%s\n"%mod)
21 outfp.write('extern PyObject* PyInit_%s(void);\n' % mod)
22 if with_ifdef:
23 outfp.write("#endif\n")
24 elif m2 and m2.search(line):
25 m2 = None
26 for mod in modules:
27 if mod in never:
28 continue
29 outfp.write('\t{"%s", PyInit_%s},\n' %
30 (mod, mod))
31 if m1:
32 sys.stderr.write('MARKER 1 never found\n')
33 elif m2:
34 sys.stderr.write('MARKER 2 never found\n')
35
36
37# Test program.

Callers 1

testFunction · 0.85

Calls 3

compileMethod · 0.45
writeMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…