コード例 #1
0
ファイル: package.py プロジェクト: zmedico/gentoolkit
	def format_mask_status2(self):
		"""Get the mask status of a given package.
		"""
		mask = self.pkg.mask_status()
		if mask:
			return pp.masking(mask)
		else:
			arch = self.pkg.settings("ARCH")
			keywords = self.pkg.environment('KEYWORDS')
			mask =  [determine_keyword(arch,
				portage.settings["ACCEPT_KEYWORDS"],
				keywords)]
		return pp.masking(mask)
コード例 #2
0
ファイル: package.py プロジェクト: pamxy/gentoolkit
	def format_mask_status2(self):
		"""Get the mask status of a given package.
		"""
		mask = self.pkg.mask_status()
		if mask:
			return pp.masking(mask)
		else:
			arch = self.pkg.settings("ARCH")
			keywords = self.pkg.environment('KEYWORDS')
			mask =  [determine_keyword(arch,
				portage.settings["ACCEPT_KEYWORDS"],
				keywords)]
		return pp.masking(mask)
コード例 #3
0
ファイル: depgraph.py プロジェクト: pamxy/gentoolkit
def depgraph_printer(depth,
                     pkg,
                     dep,
                     no_use=False,
                     no_atom=False,
                     no_indent=False,
                     initial_pkg=False,
                     no_mask=False):
    """Display L{gentoolkit.dependencies.Dependencies.graph_depends} results.

	@type depth: int
	@param depth: depth of indirection, used to calculate indent
	@type pkg: L{gentoolkit.package.Package}
	@param pkg: "best match" package matched by B{dep}
	@type dep: L{gentoolkit.atom.Atom}
	@param dep: dependency that matched B{pkg}
	@type no_use: bool
	@param no_use: don't output USE flags
	@type no_atom: bool
	@param no_atom: don't output dep atom
	@type no_indent: bool
	@param no_indent: don't output indent based on B{depth}
	@type initial_pkg: bool
	@param initial_pkg: somewhat of a hack used to print the root package of
		the graph with absolutely no indent
	"""
    indent = '' if no_indent or initial_pkg else ' ' + (' ' * depth)
    decorator = '[%3d] ' % depth if no_indent else '`-- '
    use = ''
    atom = ''
    mask = ''
    try:
        if not no_atom:
            if dep.operator == '=*':
                atom += ' (=%s*)' % dep.cpv
            else:
                atom += ' (%s%s)' % (dep.operator, dep.cpv)
        if not no_use and dep is not None and dep.use:
            use = ' [%s]' % ' '.join(
                pp.useflag(x, enabled=True) for x in dep.use.tokens)
    except AttributeError:
        # 'NoneType' object has no attribute 'atom'
        pass
    if pkg and not no_mask:
        mask = pkg.mask_status()
        if not mask:
            mask = [
                determine_keyword(portage.settings["ARCH"],
                                  portage.settings["ACCEPT_KEYWORDS"],
                                  pkg.environment('KEYWORDS'))
            ]
        mask = pp.masking(mask)
    try:
        pp.uprint(' '.join(
            (indent, decorator, pp.cpv(str(pkg.cpv)), atom, mask, use)))
    except AttributeError:
        # 'NoneType' object has no attribute 'cpv'
        pp.uprint(''.join((indent, decorator, "(no match for %r)" % dep.atom)))
コード例 #4
0
def depgraph_printer(depth, pkg, dep, no_use=False, no_atom=False, no_indent=False, initial_pkg=False, no_mask=False):
    """Display L{gentoolkit.dependencies.Dependencies.graph_depends} results.

	@type depth: int
	@param depth: depth of indirection, used to calculate indent
	@type pkg: L{gentoolkit.package.Package}
	@param pkg: "best match" package matched by B{dep}
	@type dep: L{gentoolkit.atom.Atom}
	@param dep: dependency that matched B{pkg}
	@type no_use: bool
	@param no_use: don't output USE flags
	@type no_atom: bool
	@param no_atom: don't output dep atom
	@type no_indent: bool
	@param no_indent: don't output indent based on B{depth}
	@type initial_pkg: bool
	@param initial_pkg: somewhat of a hack used to print the root package of
		the graph with absolutely no indent
	"""
    indent = "" if no_indent or initial_pkg else " " + (" " * depth)
    decorator = "[%3d] " % depth if no_indent else "`-- "
    use = ""
    atom = ""
    mask = ""
    try:
        if not no_atom:
            if dep.operator == "=*":
                atom += " (=%s*)" % dep.cpv
            else:
                atom += " (%s%s)" % (dep.operator, dep.cpv)
        if not no_use and dep is not None and dep.use:
            use = " [%s]" % " ".join(pp.useflag(x, enabled=True) for x in dep.use.tokens)
    except AttributeError:
        # 'NoneType' object has no attribute 'atom'
        pass
    if pkg and not no_mask:
        mask = pkg.mask_status()
        if not mask:
            mask = [
                determine_keyword(
                    portage.settings["ARCH"], portage.settings["ACCEPT_KEYWORDS"], pkg.environment("KEYWORDS")
                )
            ]
        mask = pp.masking(mask)
    try:
        pp.uprint(" ".join((indent, decorator, pp.cpv(str(pkg.cpv)), atom, mask, use)))
    except AttributeError:
        # 'NoneType' object has no attribute 'cpv'
        pp.uprint("".join((indent, decorator, "(no match for %r)" % dep.atom)))