예제 #1
0
    def __GetXMLPlatforms(self, elem: ET.Element, ownerPackageName: str,
                          directDependencies: List[XmlGenFileDependency], allowRecipes: bool,
                          defaultValues: LocalPackageDefaultValues) -> Dict[str, XmlGenFilePlatform]:
        platforms = {}  # type: Dict[str, XmlGenFilePlatform]
        for child in elem:
            if child.tag == 'Platform':
                dependencies = self._GetXMLDependencies(child)
                requirements = self._GetXMLRequirements(child)
                variants = self.__GetXMLVariants(child, ownerPackageName)
                experimentalRecipe = self._TryGetExperimentalRecipe(child, ownerPackageName, allowRecipes)
                dependencies, resED = self.__ProcessExperimentalRecipeDependencies(directDependencies, dependencies, experimentalRecipe, [])
                xmlPlatform = XmlGenFilePlatform(self.Log, child, defaultValues, requirements, dependencies, variants, experimentalRecipe, self.GetSubPackageSupport())

                if PackageString.PLATFORM_SEPARATOR in xmlPlatform.Name:
                    xmlPlatforms = self.__GenerateClones(xmlPlatform.Name, child, defaultValues, requirements, dependencies, variants, experimentalRecipe, self.GetSubPackageSupport())
                    for clonePlatform in xmlPlatforms:
                        self._AddPlatform(platforms, clonePlatform, resED)
                else:
                    self._AddPlatform(platforms, xmlPlatform, resED)

        # Handle wildcard platforms
        for platformName in APPROVED_PLATFORM_NAMES:
            if not platformName in platforms and PackageString.PLATFORM_WILDCARD in platforms:
                clone = copy.deepcopy(platforms[PackageString.PLATFORM_WILDCARD])
                clone.SYS_SetName(platformName)
                platforms[platformName] = clone

        return platforms
예제 #2
0
    def __GetXMLPlatforms(
        self, elem: ET.Element, ownerPackageName: str,
        directDependencies: List[XmlGenFileDependency], allowRecipes: bool,
        defaultValues: LocalPackageDefaultValues
    ) -> Dict[str, XmlGenFilePlatform]:
        platforms = {}  # type: Dict[str, XmlGenFilePlatform]
        for child in elem:
            if child.tag == 'Platform':
                dependencies = self._GetXMLDependencies(child)
                requirements = self._GetXMLRequirements(child)
                variants = self.__GetXMLVariants(child, ownerPackageName)
                experimentalRecipe = self._TryGetExperimentalRecipe(
                    child, ownerPackageName, allowRecipes)
                dependencies = self.__AddExperimentalRecipeDependencies(
                    directDependencies, dependencies, experimentalRecipe)
                xmlPlatform = XmlGenFilePlatform(self.Log, child,
                                                 defaultValues, requirements,
                                                 dependencies, variants,
                                                 experimentalRecipe,
                                                 self.GetSubPackageSupport())
                if xmlPlatform.Name in platforms:
                    raise PlatformAlreadyDefinedException(
                        xmlPlatform.XMLElement,
                        xmlPlatform.Name)  #, platforms[xmlPlatform.Name])
                platforms[xmlPlatform.Name] = xmlPlatform

        # Handle wildcard platforms
        for platformName in APPROVED_PLATFORM_NAMES:
            if not platformName in platforms and PackageString.PLATFORM_WILDCARD in platforms:
                clone = copy.deepcopy(
                    platforms[PackageString.PLATFORM_WILDCARD])
                clone.SYS_SetName(platformName)
                platforms[platformName] = clone

        return platforms
예제 #3
0
    def __GenerateClones(self, platformNamesStr: str, child: ET.Element, defaultValues: LocalPackageDefaultValues,
                 requirements: List[XmlGenFileRequirement], dependencies: List[XmlGenFileDependency],
                 variants: List[XmlGenFileVariant], experimentalRecipe: Optional[XmlExperimentalRecipe],
                 subPackageSupport: SubPackageSupportConfig) -> List[XmlGenFilePlatform]:

        platformNames = platformNamesStr.split(PackageString.PLATFORM_SEPARATOR)      # type: List[str]

        expandedPlatformList = [] # type: List[XmlGenFilePlatform]
        for name in platformNames:
            if self.Log.Verbosity >= 2:
                self.Log.LogPrint("Adding entry for platform '{0}' from entry marked with '{1}'".format(name, platformNamesStr));
            if not name in PackageConfig.APPROVED_PLATFORM_NAMES:
                raise XmlUnsupportedPlatformException(child, "{0}' from '{1}".format(name, platformNamesStr))

            xmlPlatform = XmlGenFilePlatform(self.Log, child, defaultValues, requirements, dependencies, variants, experimentalRecipe, self.GetSubPackageSupport())
            xmlPlatform.SYS_SetName(name)
            expandedPlatformList.append(xmlPlatform)
        return expandedPlatformList