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"): 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: file_size_str = localized_size(mysum[0]) 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)) msg.append(" " + darkgreen("Homepage:") + \ " " + homepage + "\n") msg.append(" " + darkgreen("Description:") \ + " " + desc + "\n") msg.append(" " + darkgreen("License:") + \ " " + license + "\n\n") msg.append("[ Applications found : " + \ bold(str(self.mlen)) + " ]\n\n") # This method can be called multiple times, so # reset the match count for the next call. Don't # reset it at the beginning of this method, since # that would lose modfications from the addCP # method. self.mlen = 0
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 metadata_keys = set(Package.metadata_keys) metadata_keys.update(["DESCRIPTION", "HOMEPAGE", "LICENSE", "SRC_URI"]) metadata_keys = tuple(metadata_keys) for mtype in self.matches: for match, masked in self.matches[mtype]: full_package = None if mtype == "pkg": full_package = self._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._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") if full_package: try: metadata = dict( zip(metadata_keys, self._aux_get(full_package, metadata_keys))) except KeyError: msg.append( "emerge: search: aux_get() failed, skipping\n") 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"): 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: file_size_str = localized_size(mysum[0]) 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)) msg.append(" " + darkgreen("Homepage:") + \ " " + homepage + "\n") msg.append(" " + darkgreen("Description:") \ + " " + desc + "\n") msg.append(" " + darkgreen("License:") + \ " " + license + "\n\n") writemsg_stdout(''.join(msg), noiselevel=-1)
def printUsage(_error=None, help=None): """Print help message. May also print partial help to stderr if an error from {'options','actions'} is specified.""" out = sys.stdout if _error: out = sys.stderr if not _error in ('actions', 'global-options', \ 'packages-options', 'distfiles-options', \ 'merged-packages-options', 'merged-distfiles-options', \ 'time', 'size'): _error = None if not _error and not help: help = 'all' if _error == 'time': print( pp.error("Wrong time specification"), file=out) print( "Time specification should be an integer followed by a"+ " single letter unit.", file=out) print( "Available units are: y (years), m (months), w (weeks), "+ "d (days) and h (hours).", file=out) print( "For instance: \"1y\" is \"one year\", \"2w\" is \"two"+ " weeks\", etc. ", file=out) return if _error == 'size': print( pp.error("Wrong size specification"), file=out) print( "Size specification should be an integer followed by a"+ " single letter unit.", file=out) print( "Available units are: G, M, K and B.", file=out) print("For instance: \"10M\" is \"ten megabytes\", \"200K\" "+ "is \"two hundreds kilobytes\", etc.", file=out) return if _error in ('global-options', 'packages-options', 'distfiles-options', \ 'merged-packages-options', 'merged-distfiles-options',): print( pp.error("Wrong option on command line."), file=out) print( file=out) elif _error == 'actions': print( pp.error("Wrong or missing action name on command line."), file=out) print( file=out) print( white("Usage:"), file=out) if _error in ('actions','global-options', 'packages-options', \ 'distfiles-options') or help == 'all': print( " "+turquoise(__productname__), yellow("[global-option] ..."), green("<action>"), yellow("[action-option] ..."), file=out) if _error == 'merged-distfiles-options' or help in ('all','distfiles'): print( " "+turquoise(__productname__+'-dist'), yellow("[global-option, distfiles-option] ..."), file=out) if _error == 'merged-packages-options' or help in ('all','packages'): print( " "+turquoise(__productname__+'-pkg'), yellow("[global-option, packages-option] ..."), file=out) if _error in ('global-options', 'actions'): print( " "+turquoise(__productname__), yellow("[--help, --version]"), file=out) if help == 'all': print( " "+turquoise(__productname__+"(-dist,-pkg)"), yellow("[--help, --version]"), file=out) if _error == 'merged-packages-options' or help == 'packages': print( " "+turquoise(__productname__+'-pkg'), yellow("[--help, --version]"), file=out) if _error == 'merged-distfiles-options' or help == 'distfiles': print( " "+turquoise(__productname__+'-dist'), yellow("[--help, --version]"), file=out) print(file=out) if _error in ('global-options', 'merged-packages-options', \ 'merged-distfiles-options') or help: print( "Available global", yellow("options")+":", file=out) print( yellow(" -C, --nocolor")+ " - turn off colors on output", file=out) print( yellow(" -d, --deep")+ " - only keep the minimum for a reinstallation", file=out) print( yellow(" -e, --exclude-file=<path>")+ " - path to the exclusion file", file=out) print( yellow(" -i, --interactive")+ " - ask confirmation before deletions", file=out) print( yellow(" -n, --package-names")+ " - protect all versions (when --deep)", file=out) print( yellow(" -p, --pretend")+ " - only display what would be cleaned", file=out) print( yellow(" -q, --quiet")+ " - be as quiet as possible", file=out) print( yellow(" -t, --time-limit=<time>")+ " - don't delete files modified since "+yellow("<time>"), file=out) print( " "+yellow("<time>"), "is a duration: \"1y\" is"+ " \"one year\", \"2w\" is \"two weeks\", etc. ", file=out) print( " "+"Units are: y (years), m (months), w (weeks), "+ "d (days) and h (hours).", file=out) print( yellow(" -h, --help")+ \ " - display the help screen", file=out) print( yellow(" -V, --version")+ " - display version info", file=out) print( file=out) if _error == 'actions' or help == 'all': print( "Available", green("actions")+":", file=out) print( green(" packages")+ " - clean outdated binary packages from PKGDIR", file=out) print( green(" distfiles")+ " - clean outdated packages sources files from DISTDIR", file=out) print( file=out) if _error in ('packages-options','merged-packages-options') \ or help in ('all','packages'): print( "Available", yellow("options"),"for the", green("packages"),"action:", file=out) print( yellow(" -i, --ignore-failure")+ " - ignore failure to locate PKGDIR", file=out) print( file=out) if _error in ('distfiles-options', 'merged-distfiles-options') \ or help in ('all','distfiles'): print("Available", yellow("options"),"for the", green("distfiles"),"action:", file=out) print( yellow(" -f, --fetch-restricted")+ " - protect fetch-restricted files (when --deep)", file=out) print( yellow(" -s, --size-limit=<size>")+ " - don't delete distfiles bigger than "+yellow("<size>"), file=out) print( " "+yellow("<size>"), "is a size specification: "+ "\"10M\" is \"ten megabytes\", \"200K\" is", file=out) print( " "+"\"two hundreds kilobytes\", etc. Units are: "+ "G, M, K and B.", file=out) print( file=out) print( "More detailed instruction can be found in", turquoise("`man %s`" % __productname__), file=out)
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)) msg.append(" " + darkgreen("Homepage:") + \ " " + homepage + "\n") msg.append(" " + darkgreen("Description:") \ + " " + desc + "\n") msg.append(" " + darkgreen("License:") + \ " " + license + "\n\n") writemsg_stdout(''.join(msg), noiselevel=-1)
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)) msg.append(" " + darkgreen("Homepage:") + \ " " + homepage + "\n") msg.append(" " + darkgreen("Description:") \ + " " + desc + "\n") msg.append(" " + darkgreen("License:") + \ " " + license + "\n\n") writemsg_stdout(''.join(msg), noiselevel=-1)
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"): 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: file_size_str = localized_size(mysum[0]) 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)) msg.append(" " + darkgreen("Homepage:") + \ " " + homepage + "\n") msg.append(" " + darkgreen("Description:") \ + " " + desc + "\n") msg.append(" " + darkgreen("License:") + \ " " + license + "\n\n") msg.append("[ Applications found : " + \ bold(str(self.mlen)) + " ]\n\n") # This method can be called multiple times, so # reset the match count for the next call. Don't # reset it at the beginning of this method, since # that would lose modfications from the addCP # method. self.mlen = 0
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 metadata_keys = set(Package.metadata_keys) metadata_keys.update(["DESCRIPTION", "HOMEPAGE", "LICENSE", "SRC_URI"]) metadata_keys = tuple(metadata_keys) for mtype in self.matches: for match,masked in self.matches[mtype]: full_package = None if mtype == "pkg": full_package = self._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._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") if full_package: try: metadata = dict(zip(metadata_keys, self._aux_get(full_package, metadata_keys))) except KeyError: msg.append("emerge: search: aux_get() failed, skipping\n") 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"): 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: file_size_str = localized_size(mysum[0]) 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)) msg.append(" " + darkgreen("Homepage:") + \ " " + homepage + "\n") msg.append(" " + darkgreen("Description:") \ + " " + desc + "\n") msg.append(" " + darkgreen("License:") + \ " " + license + "\n\n") writemsg_stdout(''.join(msg), noiselevel=-1)