blob: 81200fc7ae082baee5daa0c7db835bab7867186a [file] [log] [blame]
Jack Jansen11493bc2001-05-22 22:18:21 +00001# bgenall - Generate all bgen-generated modules
2#
3import sys
4import os
5import string
6
7def bgenone(dirname, shortname):
8 os.chdir(dirname)
Jack Jansen1b8bd942001-12-14 23:01:34 +00009 try:
10 m = __import__(shortname+'scan')
11 except:
12 return 0
Jack Jansen11493bc2001-05-22 22:18:21 +000013 try:
14 m.main()
15 except:
16 return 0
17 return 1
18
19def main():
20 success = []
21 failure = []
22 sys.path.insert(0, ':')
23 srcdir = os.path.join(os.path.join(sys.prefix, 'Mac'), 'Modules')
24 contents = os.listdir(srcdir)
25 for name in contents:
26 moduledir = os.path.join(srcdir, name)
27 scanmodule = os.path.join(moduledir, name +'scan.py')
28 if os.path.exists(scanmodule):
29 if bgenone(moduledir, name):
30 success.append(name)
31 else:
32 failure.append(name)
33 print 'Done:', string.join(success, ' ')
34 if failure:
35 print 'Failed:', string.join(failure, ' ')
36 return 0
37 return 1
38
39if __name__ == '__main__':
40 rv = main()
41 sys.exit(not rv)