Semi-decennial update. 50% code inflation.
[cbaos.git] / use_config.py
blob68601925eeb8e0d221f4124ea00bea9fd226ee46
1 #!/usr/bin/env python
3 import sys, os
5 if len(sys.argv) <= 1:
6 print("need an argument, config file name:")
7 for f in os.listdir('configs/'):
8 print("configs/%s" % f)
9 sys.exit()
11 # import config file
12 #execfile(sys.argv[1])
13 # for python3
14 exec(compile(open(sys.argv[1]).read(), sys.argv[1], 'exec'))
16 # check arch var exists
17 if 'ARCH' not in locals():
18 sys.exit("config file doesn't have ARCH set")
20 # create new symlinks
21 try:
22 os.remove("config.py")
23 os.remove("config.pyc")
24 os.remove("include/arch")
25 os.remove("include/mach")
26 except:
27 pass
29 os.symlink(sys.argv[1], "config.py")
30 os.symlink("../arch/" + ARCH + "/include/", "include/arch")
31 if 'MACH' in locals():
32 os.symlink("../arch/" + ARCH + "/mach-" + MACH + "/include/", "include/mach")