Exemple #1
0
def __RecursiveEnableExtension(currentNode: Union[RequirementTreeNode, AppInfoGlobalRequirementTreeNode], extensionName: str, log: Optional[Log], strIndent: str) -> bool:
    found = False
    if currentNode.Content is not None and currentNode.Content.Type == PackageRequirementTypeString.Extension and currentNode.Content.Name == extensionName:
        currentNode.Supported = True
        found = True
        if log is not None:
            log.LogPrint("{0}{1}".format(strIndent, QualifiedRequirementExtensionName.ToString(currentNode.Content.Extends, currentNode.Content.Name)))
    for child in currentNode.Children:
        if __RecursiveEnableExtension(child, extensionName, log, strIndent):
            found = True
    return found
 def __GetCompleteMissingExtensionNames(
     package: Union[Package, AppInfoPackage],
     requirementTree: Union[RequirementTree, AppInfoGlobalRequirementTree]
 ) -> List[str]:
     missing = []
     for requirement in package.ResolvedAllRequirements:
         if requirement.Type == PackageRequirementTypeString.Extension and not PackageFilter.__IsExtensionAvailable(
                 requirementTree, requirement.Extends, requirement.Name):
             missing.append(
                 QualifiedRequirementExtensionName.ToString(
                     requirement.Extends, requirement.Name))
     return missing
Exemple #3
0
def ParseExtensionList(strExtensionList: str) -> ExtensionListManager:
    parsedList = ParseList(strExtensionList, "extension", True)
    if not '*' in parsedList:
        newParsedList = []
        for entry in parsedList:
            # Do some minimal basic validation of the input
            # All extensions has to be qualified with a feature "featureName:extensionName
            values = entry.split(':')
            if not len(values) == 2:
                raise Exception(
                    "The extension list must be valid, the extension '{0}' did not follow the expected '<FeatureName>:<ExtensionName>' format"
                    .format(entry))
            if not Util.IsValidRequirementName(values[0]):
                raise Exception(
                    "The extension list must be valid, the extension '{0}' did not contain a valid feature name '{1}'"
                    .format(entry, values[0]))
            if not Util.IsValidRequirementName(values[1]):
                raise Exception(
                    "The extension list must be valid, the extension '{0}' did not contain a valid extension name '{1}'"
                    .format(entry, values[1]))
            newParsedList.append(
                QualifiedRequirementExtensionName(values[0], values[1]))
        return ExtensionListManager(False, newParsedList)
    return ExtensionListManager(True, [])