targets/__init__.py
changeset 742 41a4a560406c
parent 734 5c42cafaee15
child 762 aaacc83aa86b
equal deleted inserted replaced
741:382b2c848dac 742:41a4a560406c
    34 
    34 
    35 _base_path = path.split(__file__)[0]
    35 _base_path = path.split(__file__)[0]
    36 def _GetLocalTargetClassFactory(name):
    36 def _GetLocalTargetClassFactory(name):
    37     return lambda:getattr(__import__(name,globals(),locals()), name+"_target")
    37     return lambda:getattr(__import__(name,globals(),locals()), name+"_target")
    38 
    38 
    39 targets = {name: {"xsd":path.join(_base_path, name, "XSD"), 
    39 targets = dict([(name, {"xsd":path.join(_base_path, name, "XSD"), 
    40                   "class":_GetLocalTargetClassFactory(name),
    40                   "class":_GetLocalTargetClassFactory(name),
    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 
    47 
    48 def GetBuilder(targetname):
    48 def GetBuilder(targetname):
    49     return targets[targetname]["class"]()
    49     return targets[targetname]["class"]()