import cbaos v0.1
[cbaos.git] / use_config.py
bloba54e10c196fab14433641bc1cbfd36823ca85160
1 #!/usr/bin/env python
3 import sys, os
5 if len(sys.argv) <= 1:
6 sys.exit("need an argument, config file name")
8 # import config file
9 #execfile(sys.argv[1])
10 # for python3
11 exec(compile(open(sys.argv[1]).read(), sys.argv[1], 'exec'))
13 # check arch var exists
14 if 'ARCH' not in locals():
15 sys.exit("config file doesn't have ARCH set")
17 # create new symlinks
18 try:
19 os.remove("config.py")
20 os.remove("config.pyc")
21 os.remove("include/arch")
22 os.remove("include/mach")
23 except:
24 pass
26 os.symlink(sys.argv[1], "config.py")
27 os.symlink("../arch/" + ARCH + "/include/", "include/arch")
28 if 'MACH' in locals():
29 os.symlink("../arch/" + ARCH + "/mach-" + MACH + "/include/", "include/mach")