plugin ninja
[catalyst.git] / catalyst
1 #!/usr/bin/python
2
3 import os,sys,imp,string
4
5 #map current machine information from uname() to the mainarch we are running under
6
7 machinemap={    "i386" : "x86",
8                 "i486" : "x86",
9                 "i586" : "x86",
10                 "i686" : "x86",
11                 "x86_64" : "amd64"
12         }
13         
14 #map the mainarch we are running under to the mainarches we support for building
15 #stages and LiveCDs. (for example, on amd64, we can build stages for x86 or amd64.
16
17 targetmap={     "x86" : ["x86"],
18                 "amd64" : ["x86","amd64"]
19         }
20                 
21 mymachine=os.uname()[4]
22 if not machinemap.has_key(mymachine):
23         print "Unknown machine type:",mymachine
24         sys.exit(1)
25 hostarch=machinemap[mymachine]
26 print "Host architecture:",hostarch
27 print "Supported architecture targets:",string.join(targetmap[hostarch])
28 print "Loading plugins:",
29 archmap={}
30 for x in targetmap[hostarch]:
31         fh=open("arch/"+x+".py")
32         archmap[x]=imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
33         fh.close()      
34         print x,
35 print
36