Back to index

python3.2  3.2.2
Functions | Variables
makeconfig Namespace Reference

Functions

def makeconfig
def test

Variables

list never

Function Documentation

def makeconfig.makeconfig (   infp,
  outfp,
  modules,
  with_ifdef = 0 
)

Definition at line 9 of file makeconfig.py.

00009 
00010 def makeconfig(infp, outfp, modules, with_ifdef=0):
00011     m1 = re.compile('-- ADDMODULE MARKER 1 --')
00012     m2 = re.compile('-- ADDMODULE MARKER 2 --')
00013     for line in infp:
00014         outfp.write(line)
00015         if m1 and m1.search(line):
00016             m1 = None
00017             for mod in modules:
00018                 if mod in never:
00019                     continue
00020                 if with_ifdef:
00021                     outfp.write("#ifndef PyInit_%s\n"%mod)
00022                 outfp.write('extern PyObject* PyInit_%s(void);\n' % mod)
00023                 if with_ifdef:
00024                     outfp.write("#endif\n")
00025         elif m2 and m2.search(line):
00026             m2 = None
00027             for mod in modules:
00028                 if mod in never:
00029                     continue
00030                 outfp.write('\t{"%s", PyInit_%s},\n' %
00031                             (mod, mod))
00032     if m1:
00033         sys.stderr.write('MARKER 1 never found\n')
00034     elif m2:
00035         sys.stderr.write('MARKER 2 never found\n')
00036 
00037 
00038 # Test program.

Here is the call graph for this function:

Here is the caller graph for this function:

def makeconfig.test ( )

Definition at line 39 of file makeconfig.py.

00039 
00040 def test():
00041     if not sys.argv[3:]:
00042         print('usage: python makeconfig.py config.c.in outputfile', end=' ')
00043         print('modulename ...')
00044         sys.exit(2)
00045     if sys.argv[1] == '-':
00046         infp = sys.stdin
00047     else:
00048         infp = open(sys.argv[1])
00049     if sys.argv[2] == '-':
00050         outfp = sys.stdout
00051     else:
00052         outfp = open(sys.argv[2], 'w')
00053     makeconfig(infp, outfp, sys.argv[3:])
00054     if outfp != sys.stdout:
00055         outfp.close()
00056     if infp != sys.stdin:
00057         infp.close()


Variable Documentation

Initial value:
00001 ['marshal', 'imp', '_ast', '__main__', 'builtins',
00002          'sys', 'gc', '_warnings']

Definition at line 6 of file makeconfig.py.