targets/__init__.py
changeset 1387 435965ca8b63
parent 1001 3f966bbb3fba
child 1430 754fa90c8b27
equal deleted inserted replaced
1386:31c63a6248e1 1387:435965ca8b63
    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 = {"gcc":  path.join(_base_path, "XSD_toolchain_gcc")}
    46 toolchains = {"gcc":  path.join(_base_path, "XSD_toolchain_gcc"),
       
    47               "makefile":  path.join(_base_path, "XSD_toolchain_makefile")}
    47 
    48 
    48 def GetBuilder(targetname):
    49 def GetBuilder(targetname):
    49     return targets[targetname]["class"]()
    50     return targets[targetname]["class"]()
    50 
    51 
    51 def GetTargetChoices():
    52 def GetTargetChoices():
    53     targetchoices = ""
    54     targetchoices = ""
    54 
    55 
    55     # Get all xsd toolchains
    56     # Get all xsd toolchains
    56     for toolchainname,xsdfilename in toolchains.iteritems() :
    57     for toolchainname,xsdfilename in toolchains.iteritems() :
    57          if path.isfile(xsdfilename):
    58          if path.isfile(xsdfilename):
    58              xsd_toolchain_string = ""
    59              DictXSD_toolchain["toolchain_"+toolchainname] = \
    59              for line in open(xsdfilename).readlines():
    60                 open(xsdfilename).read()
    60                  xsd_toolchain_string += line
       
    61              DictXSD_toolchain["toolchain_"+toolchainname] = xsd_toolchain_string
       
    62 
    61 
    63     # Get all xsd targets 
    62     # Get all xsd targets 
    64     for targetname,nfo in targets.iteritems():
    63     for targetname,nfo in targets.iteritems():
    65         xsd_string = open(nfo["xsd"]).read()
    64         xsd_string = open(nfo["xsd"]).read()
    66         targetchoices +=  xsd_string%DictXSD_toolchain
    65         targetchoices +=  xsd_string%DictXSD_toolchain