41 "code": path.join(path.split(__file__)[0],name,"plc_%s_main.c"%name)} |
41 "code": path.join(path.split(__file__)[0],name,"plc_%s_main.c"%name)} |
42 for name in listdir(_base_path) |
42 for name in listdir(_base_path) |
43 if path.isdir(path.join(_base_path, name)) |
43 if path.isdir(path.join(_base_path, name)) |
44 and not name.startswith("__")} |
44 and not name.startswith("__")} |
45 |
45 |
46 toolchains = [name for name in listdir(_base_path) |
46 toolchains = {"gcc": path.join(_base_path, "XSD_toolchain_gcc")} |
47 if not path.isdir(path.join(_base_path, name)) |
|
48 and name.endswith(".py") |
|
49 and not name.startswith("__")] |
|
50 |
47 |
51 def GetBuilder(targetname): |
48 def GetBuilder(targetname): |
52 return targets[targetname]["class"]() |
49 return targets[targetname]["class"]() |
53 |
50 |
54 def GetTargetChoices(): |
51 def GetTargetChoices(): |
55 DictXSD_toolchain = {} |
52 DictXSD_toolchain = {} |
56 targetchoices = "" |
53 targetchoices = "" |
57 |
54 |
58 # Get all xsd toolchains |
55 # Get all xsd toolchains |
59 for toolchain in toolchains : |
56 for toolchainname,xsdfilename in toolchains.iteritems() : |
60 toolchainname = path.splitext(toolchain)[0] |
|
61 xsdfilename = path.join(_base_path, "XSD_%s"%(toolchainname)) |
|
62 if path.isfile(xsdfilename): |
57 if path.isfile(xsdfilename): |
63 xsd_toolchain_string = "" |
58 xsd_toolchain_string = "" |
64 for line in open(xsdfilename).readlines(): |
59 for line in open(xsdfilename).readlines(): |
65 xsd_toolchain_string += line |
60 xsd_toolchain_string += line |
66 DictXSD_toolchain[toolchainname] = xsd_toolchain_string |
61 DictXSD_toolchain["toolchain_"+toolchainname] = xsd_toolchain_string |
67 |
62 |
68 # Get all xsd targets |
63 # Get all xsd targets |
69 for targetname,nfo in targets.iteritems(): |
64 for targetname,nfo in targets.iteritems(): |
70 xsd_string = open(nfo["xsd"]).read() |
65 xsd_string = open(nfo["xsd"]).read() |
71 targetchoices += xsd_string%DictXSD_toolchain |
66 targetchoices += xsd_string%DictXSD_toolchain |