本文整理汇总了Python中portage.output.darkgreen函数的典型用法代码示例。如果您正苦于以下问题:Python darkgreen函数的具体用法?Python darkgreen怎么用?Python darkgreen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了darkgreen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _set_non_root_columns
def _set_non_root_columns(self, addl, pkg_info, pkg):
"""sets the indent level and formats the output
@param addl: already defined string to add to
@param pkg_info: dictionary
@param pkg: _emerge.Package instance
@rtype string
"""
if self.conf.quiet:
myprint = addl + " " + self.indent + \
self.pkgprint(pkg_info.cp, pkg_info)
myprint = myprint+darkblue(" "+pkg_info.ver)+" "
myprint = myprint+pkg_info.oldbest
myprint = myprint+darkgreen("to "+pkg.root)
self.verboseadd = None
else:
if not pkg_info.merge:
myprint = "[%s] %s%s" % \
(self.pkgprint(pkg_info.operation.ljust(13), pkg_info),
self.indent, self.pkgprint(pkg.cp, pkg_info))
else:
myprint = "[%s %s] %s%s" % \
(self.pkgprint(pkg.type_name, pkg_info), addl,
self.indent, self.pkgprint(pkg.cp, pkg_info))
if (self.newlp-nc_len(myprint)) > 0:
myprint = myprint+(" "*(self.newlp-nc_len(myprint)))
myprint = myprint+"["+darkblue(pkg_info.ver)+"] "
if (self.oldlp-nc_len(myprint)) > 0:
myprint = myprint+" "*(self.oldlp-nc_len(myprint))
myprint = myprint+pkg_info.oldbest
myprint += darkgreen("to " + pkg.root)
return myprint
开发者ID:Acidburn0zzz,项目名称:portage-funtoo,代码行数:32,代码来源:output.py
示例2: getInstallationStatus
def getInstallationStatus(self,package):
installed_package = self.vartree.dep_bestmatch(package)
result = ""
version = self.getVersion(installed_package,search.VERSION_RELEASE)
if len(version) > 0:
result = darkgreen("Latest version installed:")+" "+version
else:
result = darkgreen("Latest version installed:")+" [ Not Installed ]"
return result
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:9,代码来源:search.py
示例3: search_ebuilds
def search_ebuilds(path, portdir=True, searchdef="", repo_num="",
config=None, data=None):
pv = ""
pkgs = []
nr = len(data['ebuilds']) + 1
if portdir:
rep = darkgreen("Portage ")
else:
rep = red("Overlay "+str(repo_num)+" ")
if isdir(path):
filelist = listdir(path)
for file in filelist:
if file[-7:] == ".ebuild":
pv = file[:-7]
pkgs.append(list(pkgsplit(pv)))
pkgs[-1].append(path + file)
if searchdef != "" and pv == searchdef:
data['defebuild'] = (searchdef, pkgs[-1][3])
if not portdir:
config['found_in_overlay'] = True
pkgs.sort(key=cmp_sort_key(mypkgcmp))
for pkg in pkgs:
rev = ""
if pkg[2] != "r0":
rev = "-" + pkg[2]
data['output'].append(" " + rep + " [" + bold(str(nr)) + "] " +
pkg[0] + "-" + pkg[1] + rev + "\n")
data['ebuilds'].append(pkg[len(pkg)-1])
nr += 1
开发者ID:magical,项目名称:esearch,代码行数:32,代码来源:search.py
示例4: parseopts
def parseopts(opts, config=None):
if config is None:
config = CONFIG
if len(opts[1]) == 0:
usage()
for a in opts[0]:
arg = a[0]
if arg in ("-h", "--help"):
usage()
if arg in ("-S", "--searchdesc"):
config['searchdesc'] = True
elif arg in ("-F", "--fullname"):
config['fullname'] = True
elif arg in ("-I", "--instonly"):
config['instonly'] = True
elif arg in ("-N", "--notinst"):
config['notinst'] = True
elif arg in ("-c", "--compact"):
config['outputm'] = COMPACT
elif arg in ("-v", "--verbose"):
config['outputm'] = VERBOSE
elif arg in ("-e", "--ebuild"):
config['portdir'] = settings["PORTDIR"]
config['overlay'] = settings["PORTDIR_OVERLAY"]
config['outputm'] = EBUILDS
elif arg in ("-x", "--exclude"):
config['exclude'].append(a[1])
elif arg in ("-o", "--own"):
config['outputm'] = OWN
config['outputf'] = a[1]
elif arg in ("-d", "--directory"):
config['esearchdbdir'] = a[1]
if not exists(config['esearchdbdir']):
error("directory '" + darkgreen(config['esearchdbdir']) +
"' does not exist.", stderr=config['stderr'])
elif arg in ("-n", "--nocolor"):
nocolor()
if config['fullname'] and config['searchdesc']:
error("Please use either " + darkgreen("--fullname") +
" or " + darkgreen("--searchdesc"), stderr=config['stderr'])
return config
开发者ID:fuzzyray,项目名称:esearch,代码行数:44,代码来源:search.py
示例5: update_scroll
def update_scroll(self):
if self._return_early():
return
if(self.spinpos >= len(self.scroll_sequence)):
sys.stdout.write(darkgreen(" \b\b\b" + self.scroll_sequence[
len(self.scroll_sequence) - 1 - (self.spinpos % len(self.scroll_sequence))]))
else:
sys.stdout.write(green("\b " + self.scroll_sequence[self.spinpos]))
sys.stdout.flush()
self.spinpos = (self.spinpos + 1) % (2 * len(self.scroll_sequence))
开发者ID:Acidburn0zzz,项目名称:portage-funtoo,代码行数:10,代码来源:stdout_spinner.py
示例6: getInstallationStatus
def getInstallationStatus(self,package):
installed_package = self._vardb.match(package)
if installed_package:
try:
self._vardb.match_unordered
except AttributeError:
installed_package = installed_package[-1]
else:
installed_package = portage.best(installed_package)
else:
installed_package = ""
result = ""
version = self.getVersion(installed_package,search.VERSION_RELEASE)
if len(version) > 0:
result = darkgreen("Latest version installed:")+" "+version
else:
result = darkgreen("Latest version installed:")+" [ Not Installed ]"
return result
开发者ID:Whissi,项目名称:portage,代码行数:19,代码来源:search.py
示例7: main
def main():
try:
opts = getopt(sys.argv[1:], "hvqd:n",
["help", "verbose", "quiet", "directory=", "nocolor"]
)
except GetoptError as error:
error(error + "(see" + darkgreen("--help") +
"for all options)" + '\n')
config = parseopts(opts)
success = updatedb(config)
# sys.exit() values are opposite T/F
sys.exit(not success)
开发者ID:JNRowe-retired,项目名称:esearch,代码行数:12,代码来源:update.py
示例8: main
def main():
try:
opts = getopt(sys.argv[1:], "hwdlmnqvs",
["help", "webrsync", "delta-webrsync", "layman-sync",
"nocolor", "verbose", "metadata", "nospinner",
"quiet"])
except GetoptError as error:
error(str(error) + " (see" + darkgreen("--help") + " for all options)")
config = parseopts(opts)
success = sync(config)
# sys.exit() values are opposite T/F
sys.exit(not success)
开发者ID:JNRowe-retired,项目名称:esearch,代码行数:12,代码来源:sync.py
示例9: _set_non_root_columns
def _set_non_root_columns(self, addl, pkg_info, pkg):
"""sets the indent level and formats the output
@param addl: already defined string to add to
@param pkg_info: dictionary
@param pkg: _emerge.Package.Package instance
@rtype string
"""
ver_str = pkg_info.ver
if self.conf.verbosity == 3 and not self.quiet_repo_display and (self.verbose_main_repo_display or
any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg])):
ver_str += _repo_separator + pkg.repo
if self.conf.quiet:
myprint = addl + " " + self.indent + \
self.pkgprint(pkg_info.cp, pkg_info)
myprint = myprint+darkblue(" "+ver_str)+" "
myprint = myprint+pkg_info.oldbest
myprint = myprint+darkgreen("to "+pkg.root)
self.verboseadd = None
else:
if not pkg_info.merge:
myprint = "[%s] %s%s" % \
(self.pkgprint(pkg_info.operation.ljust(13), pkg_info),
self.indent, self.pkgprint(pkg.cp, pkg_info))
else:
myprint = "[%s %s] %s%s" % \
(self.pkgprint(pkg.type_name, pkg_info), addl,
self.indent, self.pkgprint(pkg.cp, pkg_info))
if (self.newlp-nc_len(myprint)) > 0:
myprint = myprint+(" "*(self.newlp-nc_len(myprint)))
myprint = myprint+" "+darkblue("["+ver_str+"]")+" "
if (self.oldlp-nc_len(myprint)) > 0:
myprint = myprint+" "*(self.oldlp-nc_len(myprint))
myprint = myprint+pkg_info.oldbest
myprint += darkgreen("to " + pkg.root)
return myprint
开发者ID:zy-sunshine,项目名称:easymgc,代码行数:36,代码来源:output.py
示例10: _set_non_root_columns
def _set_non_root_columns(self, pkg, pkg_info):
"""sets the indent level and formats the output
@param pkg: _emerge.Package.Package instance
@param pkg_info: dictionary
@rtype string
"""
ver_str = pkg_info.ver
if self.conf.verbosity == 3:
ver_str = self._append_slot(ver_str, pkg, pkg_info)
ver_str = self._append_repository(ver_str, pkg, pkg_info)
if self.conf.quiet:
myprint = _unicode(pkg_info.attr_display) + " " + self.indent + \
self.pkgprint(pkg_info.cp, pkg_info)
myprint = myprint+darkblue(" "+ver_str)+" "
myprint = myprint+pkg_info.oldbest
myprint = myprint+darkgreen("to "+pkg.root)
self.verboseadd = None
else:
if not pkg_info.merge:
myprint = "[%s] %s%s" % \
(self.pkgprint(pkg_info.operation.ljust(13), pkg_info),
self.indent, self.pkgprint(pkg.cp, pkg_info))
else:
myprint = "[%s %s] %s%s" % \
(self.pkgprint(pkg.type_name, pkg_info),
pkg_info.attr_display,
self.indent, self.pkgprint(pkg.cp, pkg_info))
if (self.newlp-nc_len(myprint)) > 0:
myprint = myprint+(" "*(self.newlp-nc_len(myprint)))
myprint = myprint+" "+darkblue("["+ver_str+"]")+" "
if (self.oldlp-nc_len(myprint)) > 0:
myprint = myprint+" "*(self.oldlp-nc_len(myprint))
myprint = myprint+pkg_info.oldbest
myprint += darkgreen("to " + pkg.root)
return myprint
开发者ID:pombredanne,项目名称:portage-3,代码行数:36,代码来源:output.py
示例11: main
def main():
try:
opts = getopt(sys.argv[1:], "hSFINcveo:d:n",
["help", "searchdesc", "fullname", "instonly", "notinst",
"compact", "verbose", "ebuild", "own=", "directory=", "nocolor"
])
except GetoptError as errmsg:
error(str(errmsg) + " (see " + darkgreen("--help") + " for all options)")
config = parseopts(opts)
db = loaddb(config)
regexlist = create_regexp(config, opts[1])
found = search_list(config, regexlist, db)
success = output_results(config, regexlist, found)
# sys.exit() values are opposite T/F
sys.exit(not success)
开发者ID:JNRowe-retired,项目名称:esearch,代码行数:17,代码来源:search.py
示例12: do_normal
def do_normal(pkg, verbose):
data = []
if not pkg[4]:
installed = "[ Not Installed ]"
else:
installed = pkg[4]
if pkg[2]:
masked = red(" [ Masked ]")
else:
masked = ""
data.append("%s %s%s\n %s %s\n %s %s" % \
(green("*"), bold(pkg[1]), masked,
darkgreen("Latest version available:"), pkg[3],
darkgreen("Latest version installed:"), installed))
if verbose:
mpv = best(portdb.xmatch("match-all", pkg[1]))
iuse_split, final_use = get_flags(mpv, final_setting=True)
iuse = ""
use_list = []
for ebuild_iuse in iuse_split:
use = ebuild_iuse.lstrip('+-')
if use in final_use:
use_list.append(red("+" + use) + " ")
else:
use_list.append(blue("-" + use) + " ")
use_list.sort()
iuse = ' '.join(use_list)
if iuse == "":
iuse = "-"
data.append(" %s %s\n %s %s" % \
(darkgreen("Unstable version:"), pkg_version(mpv),
darkgreen("Use Flags (stable):"), iuse))
data.append(" %s %s\n %s %s\n %s %s\n %s %s\n" % \
(darkgreen("Size of downloaded files:"), pkg[5],
darkgreen("Homepage:"), pkg[6],
darkgreen("Description:"), pkg[7],
darkgreen("License:"), pkg[8]))
return data
开发者ID:magical,项目名称:esearch,代码行数:43,代码来源:search.py
示例13: parseopts
def parseopts(opts, config=None):
if config is None:
config = CONFIG
config['verbose'] = 0
for a in opts[0]:
arg = a[0]
if arg in ("-h", "--help"):
usage()
elif arg in ("-v", "--verbose"):
config['verbose'] = 1
elif arg in ("-q", "--quiet"):
config['verbose'] = -1
elif arg in ("-d", "--directory"):
config['esearchdbdir'] = a[1]
if not exists(config['esearchdbdir']):
error("directory '" + darkgreen(config['esearchdbdir']) +
"'", "does not exist.", stderr=config['stderr'])
elif arg in ("-n", "--nocolor"):
nocolor()
return config
开发者ID:JNRowe-retired,项目名称:esearch,代码行数:20,代码来源:update.py
示例14: output
def output(self):
"""Outputs the results of the search."""
class msg(object):
@staticmethod
def append(msg):
writemsg_stdout(msg, noiselevel=-1)
msg.append("\b\b \n[ Results for search key : " + \
bold(self.searchkey) + " ]\n")
vardb = self._vardb
metadata_keys = set(Package.metadata_keys)
metadata_keys.update(["DESCRIPTION", "HOMEPAGE", "LICENSE", "SRC_URI"])
metadata_keys = tuple(metadata_keys)
if self._results_specified:
# Handle results added via addCP
addCP_matches = []
for mytype, matches in self.matches.items():
for match in matches:
addCP_matches.append((mytype, match))
iterator = iter(addCP_matches)
else:
# Do a normal search
iterator = self._iter_search()
for mtype, match in iterator:
self.mlen += 1
masked = False
full_package = None
if mtype in ("pkg", "desc"):
full_package = self._xmatch(
"bestmatch-visible", match)
if not full_package:
masked = True
full_package = self._xmatch("match-all", match)
if full_package:
full_package = full_package[-1]
elif mtype == "set":
msg.append(green("*") + " " + bold(match) + "\n")
if self.verbose:
msg.append(" " + darkgreen("Description:") + \
" " + \
self.sdict[match].getMetadata("DESCRIPTION") \
+ "\n\n")
if full_package:
try:
metadata = dict(zip(metadata_keys,
self._aux_get(full_package, metadata_keys)))
except KeyError:
self._aux_get_error(full_package)
continue
desc = metadata["DESCRIPTION"]
homepage = metadata["HOMEPAGE"]
license = metadata["LICENSE"]
if masked:
msg.append(green("*") + " " + \
white(match) + " " + red("[ Masked ]") + "\n")
else:
msg.append(green("*") + " " + bold(match) + "\n")
myversion = self.getVersion(full_package, search.VERSION_RELEASE)
mysum = [0,0]
file_size_str = None
mycat = match.split("/")[0]
mypkg = match.split("/")[1]
mycpv = match + "-" + myversion
myebuild = self._findname(mycpv)
if myebuild:
pkg = Package(built=False, cpv=mycpv,
installed=False, metadata=metadata,
root_config=self.root_config, type_name="ebuild")
pkgdir = os.path.dirname(myebuild)
mf = self.settings.repositories.get_repo_for_location(
os.path.dirname(os.path.dirname(pkgdir)))
mf = mf.load_manifest(
pkgdir, self.settings["DISTDIR"])
try:
uri_map = _parse_uri_map(mycpv, metadata,
use=pkg.use.enabled)
except portage.exception.InvalidDependString as e:
file_size_str = "Unknown (%s)" % (e,)
del e
else:
try:
mysum[0] = mf.getDistfilesSize(uri_map)
except KeyError as e:
file_size_str = "Unknown (missing " + \
"digest for %s)" % (e,)
del e
available = False
for db in self._dbs:
if db is not vardb and \
db.cpv_exists(mycpv):
available = True
if not myebuild and hasattr(db, "bintree"):
#.........这里部分代码省略.........
开发者ID:gentoo,项目名称:portage,代码行数:101,代码来源:search.py
示例15: output_results
def output_results(config, regexlist, found):
data = {}
data['ebuilds'] = []
data['defebuild'] = (0, 0)
data['output'] = []
count = 0
for pkg in found:
if config['outputm'] in (NORMAL, VERBOSE):
data['output'] += do_normal(pkg, config['outputm'] == VERBOSE)
elif config['outputm'] in (COMPACT, EBUILDS):
data['output'].append(do_compact(pkg))
elif config['outputm'] == OWN:
data['output'].append(do_own(pkg, config['outputf']))
if config['outputm'] == EBUILDS:
if count == 0:
searchdef = pkg[0] + "-" + pkg[3]
else:
searchdef = ""
search_ebuilds("%s/%s/" % (config['portdir'], pkg[1]),
True, searchdef, "", config, data)
if config['overlay']:
repo_num=1
for repo in config['overlay'].split():
search_ebuilds("%s/%s/" % ( repo, pkg[1]),
False, searchdef,repo_num, config, data)
repo_num += 1
count += 1
data['count'] = len(found)
data['output'] = '\n'.join(data['output'])
if config['outputm'] in (NORMAL, VERBOSE):
#print("[ Results for search key :", bold(pattern), "]")
print("[ Applications found :", bold(str(count)), "]\n")
try:
print(data['output'], end=' ')
print("")
except IOError:
pass
else:
print(data['output'])
if config['outputm'] == EBUILDS:
if config['overlay'] and config['found_in_overlay']:
repo_num=1
for repo in config['overlay'].split():
print(red("Overlay "+str(repo_num)+" : "+repo))
repo_num += 1
if count != 0:
if count > 1:
data['defebuild'] = (0, 0)
if len(data['ebuilds']) == 1:
nr = 1
else:
if data['defebuild'][0] != 0:
print(bold("\nShow Ebuild"), " (" + darkgreen(data['defebuild'][0]) + "): ", end=' ')
else:
print(bold("\nShow Ebuild: "), end=' ')
try:
nr = sys.stdin.readline()
except KeyboardInterrupt:
return False
try:
editor = getenv("EDITOR")
if editor:
system(editor + " " + data['ebuilds'][int(nr) - 1])
else:
print("")
error("Please set EDITOR", False, stderr=config['stderr'])
except IndexError:
print("", file=config['stderr'])
error("No such ebuild", False, stderr=config['stderr'])
except ValueError:
if data['defebuild'][0] != 0:
system(editor + " " + data['defebuild'][1])
else:
print("", file=config['stderr'])
error("Please enter a valid number", False,
stderr=config['stderr'])
return True
开发者ID:magical,项目名称:esearch,代码行数:88,代码来源:search.py
示例16: usage
def usage():
print("esearch (%s) - Replacement for 'emerge search' with search-index" % version)
print("")
print(bold("Usage:"), "esearch [", darkgreen("options"), "] pattern")
print(bold("Options:"))
print(darkgreen(" --help") + ", " + darkgreen("-h"))
print(" Print help message")
print("")
print(darkgreen(" --searchdesc") + ", " + darkgreen("-S"))
print(" Search package descriptions as well")
print("")
print(darkgreen(" --fullname") + ", " + darkgreen("-F"))
print(" Search packages full name (includes category)")
print("")
print(darkgreen(" --instonly") + ", " + darkgreen("-I"))
print(" Find only packages which are installed")
print("")
print(darkgreen(" --notinst") + ", " + darkgreen("-N"))
print(" Find only packages which are not installed")
print("")
print(darkgreen(" --exclude=") + "xpattern" + ", " + darkgreen("-x"), "xpattern")
print(" Exclude packages matching xpattern from search result")
print("")
print(darkgreen(" --compact") + ", " + darkgreen("-c"))
print(" More compact output format")
print("")
print(darkgreen(" --verbose") + ", " + darkgreen("-v"))
print(" Give a lot of additional information (slow!)")
print("")
print(darkgreen(" --ebuild") + ", " + darkgreen("-e"))
print(" View ebuilds of found packages")
print("")
print(darkgreen(" --own=") + "format" + ", " + darkgreen("-o"), "format")
print(" Use your own output format, see manpage for details of format")
print("")
print(darkgreen(" --directory=") + "dir" + ", " + darkgreen("-d"), "dir")
print(" Use dir as directory to load esearch index from")
print("")
print(darkgreen(" --nocolor") + ", " + darkgreen("-n"))
print(" Don't use ANSI codes for colored output")
sys.exit(0)
开发者ID:magical,项目名称:esearch,代码行数:42,代码来源:search.py
示例17: unmerge
#.........这里部分代码省略.........
vdb_len = len(vdb_path)
sp_vdb = vdb_path.split("/")
sp_vdb_len = len(sp_vdb)
if not os.path.exists(absx+"/CONTENTS"):
print("!!! Not a valid db dir: "+str(absx))
return 0
if sp_absx_len <= sp_vdb_len:
# The Path is shorter... so it can't be inside the vdb.
print(sp_absx)
print(absx)
print("\n!!!",x,"cannot be inside "+ \
vdb_path+"; aborting.\n")
return 0
for idx in range(0,sp_vdb_len):
if idx >= sp_absx_len or sp_vdb[idx] != sp_absx[idx]:
print(sp_absx)
print(absx)
print("\n!!!", x, "is not inside "+\
vdb_path+"; aborting.\n")
return 0
print("="+"/".join(sp_absx[sp_vdb_len:]))
candidate_catpkgs.append(
"="+"/".join(sp_absx[sp_vdb_len:]))
newline=""
if (not "--quiet" in myopts):
newline="\n"
if settings["ROOT"] != "/":
writemsg_level(darkgreen(newline+ \
">>> Using system located in ROOT tree %s\n" % \
settings["ROOT"]))
if (("--pretend" in myopts) or ("--ask" in myopts)) and \
not ("--quiet" in myopts):
writemsg_level(darkgreen(newline+\
">>> These are the packages that would be unmerged:\n"))
# Preservation of order is required for --depclean and --prune so
# that dependencies are respected. Use all_selected to eliminate
# duplicate packages since the same package may be selected by
# multiple atoms.
pkgmap = []
all_selected = set()
for x in candidate_catpkgs:
# cycle through all our candidate deps and determine
# what will and will not get unmerged
try:
mymatch = vartree.dbapi.match(x)
except portage.exception.AmbiguousPackageName as errpkgs:
print("\n\n!!! The short ebuild name \"" + \
x + "\" is ambiguous. Please specify")
print("!!! one of the following fully-qualified " + \
"ebuild names instead:\n")
for i in errpkgs[0]:
print(" " + green(i))
print()
sys.exit(1)
if not mymatch and x[0] not in "<>=~":
mymatch = localtree.dep_match(x)
if not mymatch:
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:67,代码来源:unmerge.py
示例18: usage
def usage():
print("esync (%s) - Calls 'emerge sync' and 'eupdatedb' and shows updates" \
% version)
print("")
print(bold("Usage:"), "esync [", darkgreen("options"), "]")
print(bold("Options:"))
print(darkgreen(" --help") + ", " + darkgreen("-h"))
print(" Print this help message")
print("")
print(darkgreen(" --webrsync") + ", " + darkgreen("-w"))
print(" Use 'emerge-webrsync' instead of 'emerge --sync'")
print("")
print(darkgreen(" --delta-webrsync") + ", " + darkgreen("-d"))
print(" Use 'emerge-delta-webrsync' instead of 'emerge --sync'")
print("")
print(darkgreen(" --metadata") + ", " + darkgreen("-m"))
print(" Use 'emerge --metadata' instead of 'emerge --sync'")
print("")
print(darkgreen(" --layman-sync") + ", " + darkgreen("-l"))
print(" Use layman to sync any installed overlays, then sync the main tree")
print("")
print(darkgreen(" --nocolor") + ", " + darkgreen("-n"))
print(" Don't use ANSI codes for colored output")
print("")
print(darkgreen(" --quiet") + ", " + darkgreen("-q"))
print(" Less output (implies --nospinner)")
print("")
print(darkgreen(" --verbose") + ", " + darkgreen("-v"))
print(" Verbose output")
print("")
print(darkgreen(" --nospinner") + ", " + darkgreen("-s"))
print(" Don't display the remaining index count")
sys.exit(0)
开发者ID:JNRowe-retired,项目名称:esearch,代码行数:34,代码来源:sync.py
示例19: usage
def usage():
print("eupdatedb (%s) - Update the search-index for esearch" % version)
print("")
print(bold("Usage:"), "eupdatedb [", darkgreen("options"), "]")
print(bold("Options:"))
print(darkgreen(" --help") + ", " + darkgreen("-h"))
print(" Print this help message")
print("")
print(darkgreen(" --verbose") + ", " + darkgreen("-v"))
print(" Verbose mode, show categories")
print("")
print(darkgreen(" --quiet") + ", " + darkgreen("-q"))
print(" Print only summary")
print("")
print(darkgreen(" --directory=") + "dir, " + darkgreen("-d") + " dir")
print(" Load esearch index from dir")
print("")
print(darkgreen(" --nocolor") + ", " + darkgreen("-n"))
print(" Don't use ANSI codes for colored output")
sys.exit(0)
开发者ID:JNRowe-retired,项目名称:esearch,代码行数:21,代码来源:update.py
示例20: output
def output(self):
"""Outputs the results of the search."""
msg = []
msg.append("\b\b \n[ Results for search key : " + \
bold(self.searchkey) + " ]\n")
msg.append("[ Applications found : " + \
bold(str(self.mlen)) + " ]\n\n")
vardb = self.vartree.dbapi
for mtype in self.matches:
for match,masked in self.matches[mtype]:
full_package = None
if mtype == "pkg":
catpack = match
full_package = self.portdb.xmatch(
"bestmatch-visible", match)
if not full_package:
#no match found; we don't want to query description
masked=1
full_package = portage.best(
self.portdb.xmatch("match-all",match))
elif mtype == "desc":
full_package = match
match = portage.cpv_getkey(match)
elif mtype == "set":
msg.append(green("*") + " " + bold(match) + "\n")
if self.verbose:
msg.append(" " + darkgreen("Description:") + \
" " + \
self.sdict[match].getMetadata("DESCRIPTION") \
+ "\n\n")
writemsg_stdout(''.join(msg), noiselevel=-1)
if full_package:
try:
desc, homepage, license = self.portdb.aux_get(
full_package, ["DESCRIPTION","HOMEPAGE","LICENSE"])
except KeyError:
msg.append("emerge: search: aux_get() failed, skipping\n")
continue
if masked:
msg.append(green("*") + " " + \
white(match) + " " + red("[ Masked ]") + "\n")
else:
msg.append(green("*") + " " + bold(match) + "\n")
myversion = self.getVersion(full_package, search.VERSION_RELEASE)
mysum = [0,0]
file_size_str = None
mycat = match.split("/")[0]
mypkg = match.split("/")[1]
mycpv = match + "-" + myversion
myebuild = self.portdb.findname(mycpv)
if myebuild:
pkgdir = os.path.dirname(myebuild)
from portage import manifest
mf = manifest.Manifest(
pkgdir, self.settings["DISTDIR"])
try:
uri_map = self.portdb.getFetchMap(mycpv)
except portage.exception.InvalidDependString as e:
file_size_str = "Unknown (%s)" % (e,)
del e
else:
try:
mysum[0] = mf.getDistfilesSize(uri_map)
except KeyError as e:
file_size_str = "Unknown (missing " + \
"digest for %s)" % (e,)
del e
available = False
for db in self._dbs:
if db is not vardb and \
db.cpv_exists(mycpv):
available = True
if not myebuild and hasattr(db, "bintree"):
myebuild = db.bintree.getname(mycpv)
try:
mysum[0] = os.stat(myebuild).st_size
except OSError:
myebuild = None
break
if myebuild and file_size_str is None:
mystr = str(mysum[0] // 1024)
mycount = len(mystr)
while (mycount > 3):
mycount -= 3
mystr = mystr[:mycount] + "," + mystr[mycount:]
file_size_str = mystr + " kB"
if self.verbose:
if available:
msg.append(" %s %s\n" % \
(darkgreen("Latest version available:"),
myversion))
msg.append(" %s\n" % \
self.getInstallationStatus(mycat+'/'+mypkg))
if myebuild:
msg.append(" %s %s\n" % \
(darkgreen("Size of files:"), file_size_str))
#.........这里部分代码省略.........
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:101,代码来源:search.py
注:本文中的portage.output.darkgreen函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论