2001-03-18 07:27:58 -04:00
|
|
|
import re
|
1994-10-03 13:33:08 -03:00
|
|
|
|
|
|
|
|
|
|
|
# Write the config.c file
|
|
|
|
|
Merged revisions 72506,72525-72526,72551,72558,72616,72654-72655,72689,72745,72750,72802,72812,72822,72824,72826-72827,72833,72876,72890,72923,72946,73026,73042,73045,73047,73065,73068-73069 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72506 | vinay.sajip | 2009-05-09 07:07:17 -0500 (Sat, 09 May 2009) | 1 line
Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying to print a traceback.
........
r72525 | benjamin.peterson | 2009-05-09 20:38:02 -0500 (Sat, 09 May 2009) | 1 line
close file explicitly
........
r72526 | benjamin.peterson | 2009-05-09 21:29:00 -0500 (Sat, 09 May 2009) | 1 line
make sure files are closed using the with statement
........
r72551 | benjamin.peterson | 2009-05-10 09:16:47 -0500 (Sun, 10 May 2009) | 1 line
use isinstance
........
r72558 | benjamin.peterson | 2009-05-10 18:52:09 -0500 (Sun, 10 May 2009) | 1 line
sys.setdefaultencoding() strikes me as a bad example
........
r72616 | benjamin.peterson | 2009-05-13 19:33:10 -0500 (Wed, 13 May 2009) | 1 line
importlib.import_module is better these days
........
r72654 | benjamin.peterson | 2009-05-14 17:37:49 -0500 (Thu, 14 May 2009) | 1 line
prevent refleaks from threads
........
r72655 | benjamin.peterson | 2009-05-14 17:40:34 -0500 (Thu, 14 May 2009) | 1 line
a useful decorator for cleaning up threads
........
r72689 | benjamin.peterson | 2009-05-16 13:44:34 -0500 (Sat, 16 May 2009) | 1 line
use skipTest()
........
r72745 | benjamin.peterson | 2009-05-17 09:16:29 -0500 (Sun, 17 May 2009) | 1 line
ignore .rst files in sphinx its self
........
r72750 | benjamin.peterson | 2009-05-17 11:59:27 -0500 (Sun, 17 May 2009) | 1 line
chop off slash
........
r72802 | georg.brandl | 2009-05-20 13:35:27 -0500 (Wed, 20 May 2009) | 1 line
#6051: refer to email examples for better way to construct email messages.
........
r72812 | michael.foord | 2009-05-21 17:57:02 -0500 (Thu, 21 May 2009) | 1 line
Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072.
........
r72822 | georg.brandl | 2009-05-22 04:33:25 -0500 (Fri, 22 May 2009) | 1 line
#6084: fix example.
........
r72824 | georg.brandl | 2009-05-22 04:43:17 -0500 (Fri, 22 May 2009) | 1 line
Fix references to file-related functions and methods (os.* vs file.*).
........
r72826 | georg.brandl | 2009-05-22 04:49:42 -0500 (Fri, 22 May 2009) | 1 line
Fix confusing wording.
........
r72827 | georg.brandl | 2009-05-22 04:50:30 -0500 (Fri, 22 May 2009) | 1 line
s/use/call/
........
r72833 | georg.brandl | 2009-05-22 12:00:17 -0500 (Fri, 22 May 2009) | 1 line
#6078: _warnings is a builtin module and has no standard init_warnings function.
........
r72876 | benjamin.peterson | 2009-05-23 15:59:09 -0500 (Sat, 23 May 2009) | 1 line
remove mention of old ctypes version
........
r72890 | gregory.p.smith | 2009-05-24 13:00:13 -0500 (Sun, 24 May 2009) | 2 lines
add a versionadded tag for set_tunnel
........
r72923 | michael.foord | 2009-05-25 15:36:56 -0500 (Mon, 25 May 2009) | 1 line
Make assertSequenceEqual error messages less cryptic, particularly for nested sequences.
........
r72946 | ronald.oussoren | 2009-05-26 13:44:48 -0500 (Tue, 26 May 2009) | 2 lines
Fixes issue 6110
........
r73026 | r.david.murray | 2009-05-29 14:30:27 -0500 (Fri, 29 May 2009) | 3 lines
Issue 6141: document that the first item of args is still the
command name even when executable is specified.
........
r73042 | benjamin.peterson | 2009-05-29 22:10:52 -0500 (Fri, 29 May 2009) | 1 line
no fdatasync on macos
........
r73045 | georg.brandl | 2009-05-30 02:26:04 -0500 (Sat, 30 May 2009) | 1 line
#6146: fix markup bug.
........
r73047 | georg.brandl | 2009-05-30 05:33:23 -0500 (Sat, 30 May 2009) | 1 line
Fix some more small markup problems.
........
r73065 | antoine.pitrou | 2009-05-30 16:39:25 -0500 (Sat, 30 May 2009) | 3 lines
The test for #5330 wasn't correct.
........
r73068 | antoine.pitrou | 2009-05-30 16:45:40 -0500 (Sat, 30 May 2009) | 3 lines
Update ACKS
........
r73069 | benjamin.peterson | 2009-05-30 19:42:42 -0500 (Sat, 30 May 2009) | 1 line
fix signature
........
2009-06-01 19:42:33 -03:00
|
|
|
never = ['marshal', '__main__', 'builtins', 'sys', 'exceptions', '_warnings']
|
1994-10-03 13:33:08 -03:00
|
|
|
|
1999-09-30 11:12:44 -03:00
|
|
|
def makeconfig(infp, outfp, modules, with_ifdef=0):
|
2004-07-18 03:16:08 -03:00
|
|
|
m1 = re.compile('-- ADDMODULE MARKER 1 --')
|
|
|
|
m2 = re.compile('-- ADDMODULE MARKER 2 --')
|
|
|
|
while 1:
|
|
|
|
line = infp.readline()
|
|
|
|
if not line: break
|
|
|
|
outfp.write(line)
|
|
|
|
if m1 and m1.search(line):
|
|
|
|
m1 = None
|
|
|
|
for mod in modules:
|
|
|
|
if mod in never:
|
|
|
|
continue
|
|
|
|
if with_ifdef:
|
|
|
|
outfp.write("#ifndef init%s\n"%mod)
|
|
|
|
outfp.write('extern void init%s(void);\n' % mod)
|
|
|
|
if with_ifdef:
|
|
|
|
outfp.write("#endif\n")
|
|
|
|
elif m2 and m2.search(line):
|
|
|
|
m2 = None
|
|
|
|
for mod in modules:
|
|
|
|
if mod in never:
|
|
|
|
continue
|
|
|
|
outfp.write('\t{"%s", init%s},\n' %
|
|
|
|
(mod, mod))
|
|
|
|
if m1:
|
|
|
|
sys.stderr.write('MARKER 1 never found\n')
|
|
|
|
elif m2:
|
|
|
|
sys.stderr.write('MARKER 2 never found\n')
|
1994-10-03 13:33:08 -03:00
|
|
|
|
|
|
|
|
|
|
|
# Test program.
|
|
|
|
|
|
|
|
def test():
|
2004-07-18 03:16:08 -03:00
|
|
|
import sys
|
|
|
|
if not sys.argv[3:]:
|
2007-02-09 19:27:01 -04:00
|
|
|
print('usage: python makeconfig.py config.c.in outputfile', end=' ')
|
|
|
|
print('modulename ...')
|
2004-07-18 03:16:08 -03:00
|
|
|
sys.exit(2)
|
|
|
|
if sys.argv[1] == '-':
|
|
|
|
infp = sys.stdin
|
|
|
|
else:
|
|
|
|
infp = open(sys.argv[1])
|
|
|
|
if sys.argv[2] == '-':
|
|
|
|
outfp = sys.stdout
|
|
|
|
else:
|
|
|
|
outfp = open(sys.argv[2], 'w')
|
|
|
|
makeconfig(infp, outfp, sys.argv[3:])
|
|
|
|
if outfp != sys.stdout:
|
|
|
|
outfp.close()
|
|
|
|
if infp != sys.stdin:
|
|
|
|
infp.close()
|
1994-10-03 13:33:08 -03:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2004-07-18 03:16:08 -03:00
|
|
|
test()
|