Exemplo n.º 1
0
    def __init__( self, category, name, autoExpand = True, parent = None ):
        subpackage, package = getSubPackage(category,name)
        PackageObjectBase.__init__(self,category,subpackage,package,version = PortageInstance.getDefaultTarget(category,package))
        self.category = category
        self.runtimeChildren = []
        self.buildChildren = []
        if parent is None:
            self._dependencyList = dict()
        else:
            self._dependencyList = parent._dependencyList

        if autoExpand:
            self.__readChildren()
Exemplo n.º 2
0
    def getDependencies(self,
                        depList=[],
                        depType=DependencyType.Both,
                        single=set(),
                        maxDepth=-1,
                        depth=0,
                        ignoredPackages=None):
        """ returns all dependencies """
        if depType == DependencyType.Runtime:
            children = self.runtimeChildren
        elif depType == DependencyType.Buildtime:
            children = self.buildChildren
        else:
            children = self.runtimeChildren + self.buildChildren

        single.add(self)
        for p in children:
            if not p in single and not p in depList\
                    and not PortageInstance.ignores.match(p.fullName())\
                    and not p.fullName() in (ignoredPackages or []):
                if maxDepth == -1:
                    p.getDependencies(depList, depType, single)
                elif depth < maxDepth:
                    p.getDependencies(depList,
                                      depType,
                                      single,
                                      maxDepth=maxDepth,
                                      depth=depth + 1)

        #if self.category != internalCategory:
        if not self in depList and not PortageInstance.ignores.match(
                PackageObjectBase.__str__(self)):
            depList.append(self)

        return depList
Exemplo n.º 3
0
    def __init__(self, category, name, autoExpand=True, parent=None):
        subpackage, package = getSubPackage(category, name)
        PackageObjectBase.__init__(self,
                                   category,
                                   subpackage,
                                   package,
                                   version=PortageInstance.getDefaultTarget(
                                       category, package))
        self.category = category
        self.runtimeChildren = []
        self.buildChildren = []
        if parent is None:
            self._dependencyList = dict()
        else:
            self._dependencyList = parent._dependencyList

        if autoExpand:
            self.__readChildren()
Exemplo n.º 4
0
    def getDependencies( self, depList = [], dep_type="both", single = set(), maxDetpth = -1, depth = 0):
        """ returns all dependencies """
        if dep_type == "runtime":
            children = self.runtimeChildren
        elif dep_type == "buildtime":
            children = self.buildChildren
        else:
            children = self.runtimeChildren + self.buildChildren

        single.add(self)
        for p in children:
            if not p in single and not p in depList\
            and not p.fullName() in PortageInstance.ignores:
                if maxDetpth == -1:
                    p.getDependencies( depList, dep_type, single )
                elif depth < maxDetpth:
                    p.getDependencies( depList, dep_type, single, maxDetpth = maxDetpth, depth = depth + 1 )
                    
        #if self.category != internalCategory:
        if not self in depList and not PackageObjectBase.__str__(self) in PortageInstance.ignores:
            depList.append( self )

        return depList
Exemplo n.º 5
0
    def getDependencies( self, depList = [], depType=DependencyType.Both, single = set(), maxDepth = -1, depth = 0, ignoredPackages = None):
        """ returns all dependencies """
        if depType == DependencyType.Runtime:
            children = self.runtimeChildren
        elif depType == DependencyType.Buildtime:
            children = self.buildChildren
        else:
            children = self.runtimeChildren + self.buildChildren

        single.add(self)
        for p in children:
            if not p in single and not p in depList\
                    and not PortageInstance.ignores.match(p.fullName())\
                    and not p.fullName() in (ignoredPackages or []):
                if maxDepth == -1:
                    p.getDependencies( depList, depType, single )
                elif depth < maxDepth:
                    p.getDependencies( depList, depType, single, maxDepth = maxDepth, depth = depth + 1 )
                    
        #if self.category != internalCategory:
        if not self in depList and not PortageInstance.ignores.match(PackageObjectBase.__str__(self)):
            depList.append( self )

        return depList
Exemplo n.º 6
0
 def __str__(self):
     return "%s: %s" % (PackageObjectBase.__str__(self), self.version)
Exemplo n.º 7
0
 def __str__(self):
     return "%s failed: %s" % (PackageObjectBase.__str__(self),
                               Exception.__str__(self))
Exemplo n.º 8
0
 def __init__(self, message, category, package, exception=None):
     Exception.__init__(self, message)
     subpackage, package = getSubPackage(category, package)
     PackageObjectBase.__init__(self, category, subpackage, package)
     self.exception = exception
Exemplo n.º 9
0
    def addPortageDir(self, directory):
        """ adds the categories and packages of a portage directory """
        if not os.path.exists(directory):
            return

        categoryList = os.listdir(directory)

        # remove vcs directories
        for vcsdir in VCSDirs():
            if vcsdir in categoryList:
                categoryList.remove(vcsdir)
        if "__pycache__" in categoryList:
            categoryList.remove("__pycache__")

        dontBuildCategoryList = self.getDontBuildPackagesList(
            os.path.join(directory))

        self.portages[directory] = []
        for category in categoryList:
            if not os.path.isdir(os.path.join(directory, category)):
                continue

            self.portages[directory].append(category)

            packageList = os.listdir(os.path.join(directory, category))

            # remove vcs directories
            for vcsdir in VCSDirs():
                if vcsdir in packageList:
                    packageList.remove(vcsdir)
            if "__pycache__" in packageList:
                packageList.remove("__pycache__")

            dontBuildPackageList = self.getDontBuildPackagesList(
                os.path.join(directory, category))

            if not category in list(self.categories.keys()):
                self.categories[category] = []

            for package in packageList:
                if not os.path.isdir(os.path.join(directory, category,
                                                  package)):
                    continue
                if not package in self.categories[category]:
                    _enabled = not category in dontBuildCategoryList and not package in dontBuildPackageList
                    self.categories[category].append(
                        PackageObjectBase(category=category,
                                          package=package,
                                          enabled=_enabled))

                subPackageList = os.listdir(
                    os.path.join(directory, category, package))

                # remove vcs directories
                for vcsdir in VCSDirs():
                    if vcsdir in subPackageList:
                        subPackageList.remove(vcsdir)
                if "__pycache__" in subPackageList:
                    subPackageList.remove("__pycache__")

                for subPackage in subPackageList:
                    if not os.path.isdir(
                            os.path.join(
                                directory, category, package,
                                subPackage)) or subPackage in VCSDirs():
                        continue

                    dontBuildSubPackageList = self.getDontBuildPackagesList(
                        os.path.join(directory, category, package))

                    if not subPackage in self.subpackages:
                        self.subpackages[subPackage] = []
                    if not subPackage in self.categories[category]:
                        _enabled = not category in dontBuildCategoryList and not package in dontBuildPackageList and not subPackage in dontBuildSubPackageList
                        self.categories[category].append(
                            PackageObjectBase(category=category,
                                              subpackage=package,
                                              package=subPackage,
                                              enabled=_enabled))
                    self.subpackages[subPackage].append(category + "/" +
                                                        package)
Exemplo n.º 10
0
 def __str__(self):
     return "%s: %s" % (PackageObjectBase.__str__(self), self.version)
Exemplo n.º 11
0
 def __str__(self):
     return "%s failed: %s" % (PackageObjectBase.__str__(self),Exception.__str__(self))
Exemplo n.º 12
0
 def __init__(self, message, category, package , exception = None):
     Exception.__init__(self, message)
     subpackage, package = getSubPackage(category,package)
     PackageObjectBase.__init__(self,category,subpackage,package)
     self.exception = exception