Ejemplo n.º 1
0
    def __Filter(self, platformContext: PlatformContext,
                 packageFilters: PackageFilters,
                 autoAddRecipeExternals: bool,
                 sourceGenFiles: List[XmlGenFile]) -> List[XmlGenFile]:

        if not packageFilters.ContainsFilters():
            return sourceGenFiles

        self.Log.LogPrint("- Filtering")
        try:
            self.Log.PushIndent()
            packageResolver = PackageResolver(platformContext, self.Config, sourceGenFiles,
                                              autoAddRecipeExternals, False,
                                              self.MarkExternalLibFirstUse,
                                              packageFilters.RecipeFilterManager)
            packages = packageResolver.Packages

            topLevelPackage = PackageListUtil.GetTopLevelPackage(packages)
            requestedFiles = self.SourceFiles
            requestedPackages = PackageUtil.TryGetPackageListFromFilenames(topLevelPackage, requestedFiles, False)
            resolvedBuildOrder = PackageFilter.Filter(self.Log, topLevelPackage, requestedPackages, packageFilters)

            # Now do a lookup of package -> Genfile to provide a filtered gen file list
            genFileSet = set(sourceGenFiles)
            return [package.GenFile for package in resolvedBuildOrder if package.GenFile is not None and package.GenFile in genFileSet]
        finally:
            self.Log.PopIndent()
Ejemplo n.º 2
0
def ShowRequirementList(log: Log,
                        basicConfig: BasicConfig,
                        topLevelPackage: Package,
                        requestedFiles: Optional[List[str]],
                        showFeaturesOnly: bool = False) -> None:
    message = "Requirements" if not showFeaturesOnly else "Features"
    filterName = None if not showFeaturesOnly else PackageRequirementTypeString.Feature
    # As the packages in requestedFiles might have been filtered at this point (and any issues already caught), we just ignore not found
    requestedPackages = PackageUtil.GetPackageListFromFilenames(
        topLevelPackage, requestedFiles, True)
    requirements = RequirementFilter.GetRequirementList(
        topLevelPackage, requestedPackages, filterName)

    if len(requirements) <= 0:
        log.DoPrint("{0}: None".format(message))
        return
    log.DoPrint("{0}:".format(message))

    rootNode = RequirementTree(requirements).RootNode

    strAddIndent = "  "
    # We only show the type group info when there is more than one
    #showTypeGroup = len(rootNode.Children) > 1
    baseIndent = ""  #strAddIndent if len(rootNode.Children) > 1 else ""

    sortedFeatures = list(rootNode.Children)
    sortedFeatures.sort(
        key=lambda s: None if s.Content is None else s.Content.Id)
    for sortedFeature in sortedFeatures:
        __PrintRequirementsNode(log, sortedFeature, baseIndent, strAddIndent)
Ejemplo n.º 3
0
def ShowExtensionList(log: Log, topLevelPackage: Package,
                      requestedFiles: Optional[List[str]]) -> None:
    # As the packages in requestedFiles might have been filtered at this point (and any issues already caught), we just ignore not found
    requestedPackages = PackageUtil.GetPackageListFromFilenames(
        topLevelPackage, requestedFiles, True)
    requirements = RequirementFilter.GetRequirementList(
        topLevelPackage, requestedPackages,
        PackageRequirementTypeString.Extension)

    if len(requirements) <= 0:
        log.DoPrint("Extensions: None")
        return
    log.DoPrint("Extensions:")

    # Pretty print useful information in name sorted order
    requirements.sort(key=lambda s: s.Id)

    currentIndent = "  "

    for requirement in requirements:
        strFormat = "{0}- '{1}'"
        if len(requirement.Version) > 0:
            strFormat += " V{2}"
        if len(requirement.Extends) > 0:
            strFormat += " extends '{3}'"
        strFormat += " (introduced by package: {4})"
        log.DoPrint(
            strFormat.format(currentIndent, requirement.Name,
                             requirement.Version, requirement.Extends,
                             ", ".join(requirement.IntroducedByPackages)))
Ejemplo n.º 4
0
    def ShowRecipeList(log: Log, topLevelPackage: Package,
                       requestedFiles: Optional[List[str]]) -> None:
        requestedPackages = PackageUtil.GetPackageListFromFilenames(
            topLevelPackage, requestedFiles)

        recipeBuildOrder = topLevelPackage.ResolvedExperimentalRecipeBuildOrder
        if recipeBuildOrder is None or len(recipeBuildOrder) <= 0:
            log.LogPrint("No recipes found")
            return

        recipePackages = list(
            topLevelPackage.ResolvedExperimentalRecipeBuildOrder)
        recipePackages.sort(
            key=lambda s: s.ResolvedDirectExperimentalRecipe.Name.lower() if s.
            ResolvedDirectExperimentalRecipe is not None else s.Name.lower())
        strAddIndent = "  "
        print("Recipes")
        for package in recipePackages:
            packageRecipe = package.ResolvedDirectExperimentalRecipe
            if packageRecipe is not None and packageRecipe.Type != RecipeType.External:
                print("{0}{1} (introduced by: {2}), type: {3}".format(
                    strAddIndent, packageRecipe.Name, package.Name,
                    RecipeType.ToString(packageRecipe.Type)))

        print("External")
        for package in recipePackages:
            packageRecipe = package.ResolvedDirectExperimentalRecipe
            if packageRecipe is not None and packageRecipe.Type == RecipeType.External:
                print("{0}{1} (introduced by: {2})".format(
                    strAddIndent, packageRecipe.Name, package.Name))