summaryrefslogtreecommitdiffstats
path: root/Mac/scripts/bgenall.py
blob: bb5ddcc1bf5e8dbae35ecc23e86c89fa7fdfd7e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# bgenall - Generate all bgen-generated modules
#
import sys
import os
import string

def bgenone(dirname, shortname):
	os.chdir(dirname)
	m = __import__(shortname+'scan')
	try:
		m.main()
	except:
		return 0
	return 1
	
def main():
	success = []
	failure = []
	sys.path.insert(0, ':')
	srcdir = os.path.join(os.path.join(sys.prefix, 'Mac'), 'Modules')
	contents = os.listdir(srcdir)
	for name in contents:
		moduledir = os.path.join(srcdir, name)
		scanmodule = os.path.join(moduledir, name +'scan.py')
		if os.path.exists(scanmodule):
			if bgenone(moduledir, name):
				success.append(name)
			else:
				failure.append(name)
	print 'Done:', string.join(success, ' ')
	if failure:
		print 'Failed:', string.join(failure, ' ')
		return 0
	return 1
	
if __name__ == '__main__':
	rv = main()
	sys.exit(not rv)