Ejemplo n.º 1
0
	def print_verbose(self, pkg, cfile):
		"Format for full output."
		file_str = pp.path(format_filetype(cfile, pkg.parsed_contents()[cfile]))
		if self.name_only:
			name = pkg.cp
		else:
			name = str(pkg.cpv)
		pp.uprint(pp.cpv(name), "(" + file_str + ")")
Ejemplo n.º 2
0
 def print_verbose(self, pkg, cfile):
     "Format for full output."
     file_str = pp.path(format_filetype(cfile, pkg.parsed_contents()[cfile]))
     if self.name_only:
         name = pkg.cp
     else:
         name = str(pkg.cpv)
     pp.uprint(pp.cpv(name), "(" + file_str + ")")
Ejemplo n.º 3
0
def display_files(contents):
    """Display the content of an installed package.

    @see: gentoolkit.package.Package.parsed_contents
    @type contents: dict
    @param contents: {'path': ['filetype', ...], ...}
    """

    filenames = list(contents.keys())
    filenames.sort()
    last = []

    for name in filenames:
        if QUERY_OPTS["output_tree"]:
            dirdepth = name.count("/")
            indent = " "
            if dirdepth == 2:
                indent = "   "
            elif dirdepth > 2:
                indent = "   " * (dirdepth - 1)

            basename = name.rsplit("/", dirdepth - 1)
            if contents[name][0] == "dir":
                if len(last) == 0:
                    last = basename
                    pp.uprint(pp.path(indent + basename[0]))
                    continue
                for i, directory in enumerate(basename):
                    try:
                        if directory in last[i]:
                            continue
                    except IndexError:
                        pass
                    last = basename
                    if len(last) == 1:
                        pp.uprint(pp.path(indent + last[0]))
                        continue
                    pp.uprint(pp.path(indent + "> /" + last[-1]))
            elif contents[name][0] == "sym":
                pp.uprint(pp.path(indent + "+"), end=" ")
                pp.uprint(pp.path_symlink(basename[-1] + " -> " + contents[name][2]))
            else:
                pp.uprint(pp.path(indent + "+ ") + basename[-1])
        else:
            pp.uprint(
                format_filetype(
                    name,
                    contents[name],
                    show_type=QUERY_OPTS["show_type"],
                    show_md5=QUERY_OPTS["show_MD5"],
                    show_timestamp=QUERY_OPTS["show_timestamp"],
                )
            )
Ejemplo n.º 4
0
def display_files(contents):
	"""Display the content of an installed package.

	@see: gentoolkit.package.Package.parsed_contents
	@type contents: dict
	@param contents: {'path': ['filetype', ...], ...}
	"""

	filenames = list(contents.keys())
	filenames.sort()
	last = []

	for name in filenames:
		if QUERY_OPTS["output_tree"]:
			dirdepth = name.count('/')
			indent = " "
			if dirdepth == 2:
				indent = "   "
			elif dirdepth > 2:
				indent = "   " * (dirdepth - 1)

			basename = name.rsplit("/", dirdepth - 1)
			if contents[name][0] == "dir":
				if len(last) == 0:
					last = basename
					pp.uprint(pp.path(indent + basename[0]))
					continue
				for i, directory in enumerate(basename):
					try:
						if directory in last[i]:
							continue
					except IndexError:
						pass
					last = basename
					if len(last) == 1:
						pp.uprint(pp.path(indent + last[0]))
						continue
					pp.uprint(pp.path(indent + "> /" + last[-1]))
			elif contents[name][0] == "sym":
				pp.uprint(pp.path(indent + "+"), end=' ')
				pp.uprint(pp.path_symlink(basename[-1] + " -> " +
					contents[name][2]))
			else:
				pp.uprint(pp.path(indent + "+ ") + basename[-1])
		else:
			pp.uprint(format_filetype(
				name,
				contents[name],
				show_type=QUERY_OPTS["show_type"],
				show_md5=QUERY_OPTS["show_MD5"],
				show_timestamp=QUERY_OPTS["show_timestamp"]
			))