当前位置: 首页>>代码示例>>Python>>正文


Python output.darkgreen函数代码示例

本文整理汇总了Python中portage.output.darkgreen函数的典型用法代码示例。如果您正苦于以下问题:Python darkgreen函数的具体用法?Python darkgreen怎么用?Python darkgreen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了darkgreen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的portage.output.darkgreen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。