コード例 #1
0
    def addDependencies(self, category, package, version = "", dep_type="both"):
        """Add a new root dependency tree to this graph."""

        pi = portage.PortageInstance

        if portage.emergePlatform.isCrossCompilingEnabled() \
        or utils.isSourceOnly():
            sp = pi.getCorrespondingSourcePackage(package)
            if sp:
                # we found such a package and we're allowed to replace it
                category = sp[0]
                package = sp[1]
                version = pi.getNewestVersion(category, package)

        if category == "":
            category = pi.getCategory(package)

        if version == "":
            version = pi.getNewestVersion(category, package)

        try:
            tag = pi.getDefaultTarget( category, package, version )
        except ImportError:
            tag = "1"

        if not os.path.exists( os.path.join( portage.getDirname( category, package ), package + "-package.xml" ) ):
            node = self.buildDepNode( category, package, version, tag, dep_type )
        else:
            node = self.buildVirtualNodes( category, package, version, tag, dep_type )

        if not node in self.roots:
            self.roots.append(node)
コード例 #2
0
ファイル: dependencies.py プロジェクト: pombredanne/emerge-1
    def buildVirtualNodes(self, category, package, version, tag, dep_type="both"):
        converter = xml2conf.Xml2Conf()
        converter.parseFile(os.path.join(portage.getDirname(category, package), package + "-package.xml"))

        key = "%s-%s-%s-%s" % (category, package, version, tag)
        try:
            node = self.key2node[key]
            return node
        except KeyError:
            pass

        rootnode = DependenciesNode(category, package, version, tag, [])
        rootnode.metaData = self.getMetaData( category, package )

        if package == converter.moduleMetaName: rootnode.virtual = True
        self.__buildSubNodes(rootnode, converter)
        return rootnode
コード例 #3
0
ファイル: dependencies.py プロジェクト: pombredanne/emerge-1
    def addDependencies(self, category, package, version = "", dep_type="both"):
        """Add a new root dependency tree to this graph."""

        pi = portage.PortageInstance

        if category == "":
            category = pi.getCategory(package)

        if version == "":
            version = pi.getNewestVersion(category, package)

        try:
            tag = pi.getDefaultTarget( category, package )
        except ImportError:
            tag = "1"

        if not os.path.exists( os.path.join( portage.getDirname( category, package ), package + "-package.xml" ) ):
            node = self.buildDepNode( category, package, version, tag, dep_type )
        else:
            node = self.buildVirtualNodes( category, package, version, tag, dep_type )

        if not node in self.roots:
            self.roots.append(node)
コード例 #4
0
ファイル: EmergeBase.py プロジェクト: pombredanne/emerge-1
 def packageDir(self):
     """ add documentation """
     return self.__adjustPath( portage.getDirname( self.category, self.package ) )