targets/__init__.py
branchpython3
changeset 3750 f62625418bff
parent 2490 2d72d8a8d7e5
child 3757 814595c0ea16
equal deleted inserted replaced
3749:fda6c1a37662 3750:f62625418bff
    33 - Target class may inherit from a toolchain_(toolchainname)
    33 - Target class may inherit from a toolchain_(toolchainname)
    34 - The target folder's name must match to name define in the XSD for TargetType
    34 - The target folder's name must match to name define in the XSD for TargetType
    35 """
    35 """
    36 
    36 
    37 
    37 
    38 from __future__ import absolute_import
    38 
    39 from os import listdir, path
    39 from os import listdir, path
    40 import util.paths as paths
    40 import util.paths as paths
    41 
    41 
    42 _base_path = paths.AbsDir(__file__)
    42 _base_path = paths.AbsDir(__file__)
    43 
    43 
    67 def GetTargetChoices():
    67 def GetTargetChoices():
    68     DictXSD_toolchain = {}
    68     DictXSD_toolchain = {}
    69     targetchoices = ""
    69     targetchoices = ""
    70 
    70 
    71     # Get all xsd toolchains
    71     # Get all xsd toolchains
    72     for toolchainname, xsdfilename in toolchains.iteritems():
    72     for toolchainname, xsdfilename in toolchains.items():
    73         if path.isfile(xsdfilename):
    73         if path.isfile(xsdfilename):
    74             DictXSD_toolchain["toolchain_"+toolchainname] = open(xsdfilename).read()
    74             DictXSD_toolchain["toolchain_"+toolchainname] = open(xsdfilename).read()
    75 
    75 
    76     # Get all xsd targets
    76     # Get all xsd targets
    77     for target_name, nfo in targets.iteritems():
    77     for target_name, nfo in targets.items():
    78         xsd_string = open(nfo["xsd"]).read()
    78         xsd_string = open(nfo["xsd"]).read()
    79         targetchoices += xsd_string % dict(DictXSD_toolchain,
    79         targetchoices += xsd_string % dict(DictXSD_toolchain,
    80                                            target_name=target_name)
    80                                            target_name=target_name)
    81 
    81 
    82     return targetchoices
    82     return targetchoices