FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Portage Developer

 
 
LinkBack Thread Tools
 
Old 03-11-2012, 03:15 AM
Mike Frysinger
 
Default portageq: add "colormap" helper

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
bin/isolated-functions.sh | 2 +-
bin/portageq | 8 ++++++++
pym/portage/output.py | 6 ++++++
pym/portage/package/ebuild/doebuild.py | 8 ++------
4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 9321ad5..98be41e 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -431,8 +431,8 @@ set_colors() {
BAD=$'e[31;01m'
HILITE=$'e[36;01m'
BRACKET=$'e[34;01m'
+ NORMAL=$'e[0m'
fi
- NORMAL=$'e[0m'
}

RC_ENDCOL="yes"
diff --git a/bin/portageq b/bin/portageq
index 5ecbb21..fcdb9d9 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -44,6 +44,7 @@ del pym_path
from portage import os
from portage.eapi import eapi_has_repo_deps
from portage.util import writemsg, writemsg_stdout
+from portage.output import colormap
portage.proxy.lazyimport.lazyimport(globals(),
'subprocess',
'_emerge.Package:Package',
@@ -685,6 +686,13 @@ def distdir(argv):
print(portage.settings["DISTDIR"])


+def colormap(argv):
+ """
+ Display the color.map as environment variables.
+ """
+ print(portage.output.colormap())
+
+
def envvar(argv):
"""<variable>+
Returns a specific environment variable as exists prior to ebuild.sh.
diff --git a/pym/portage/output.py b/pym/portage/output.py
index 43d7503..98bec81 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -325,6 +325,12 @@ def style_to_ansi_code(style):
ret += codes.get(attr_name, attr_name)
return ret

+def colormap():
+ mycolors = []
+ for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET", "NORMAL"):
+ mycolors.append("%s=$'%s'" % (c, style_to_ansi_code(c)))
+ return "
".join(mycolors)
+
def colorize(color_key, text):
global havecolor
if havecolor:
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index c45aa03..4ff3eea 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -50,7 +50,7 @@ from portage.exception import DigestException, FileNotFound,
IncorrectParameter, InvalidDependString, PermissionDenied,
UnsupportedAPIException
from portage.localization import _
-from portage.output import style_to_ansi_code
+from portage.output import colormap
from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs
from portage.util import apply_recursive_permissions,
apply_secpass_permissions, noiselimit, normalize_path,
@@ -300,11 +300,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
mysettings["PORTAGE_CONFIGROOT"], EBUILD_SH_ENV_DIR)

# Allow color.map to control colors associated with einfo, ewarn, etc...
- mycolors = []
- for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
- mycolors.append("%s=$'%s'" %
- (c, style_to_ansi_code(c)))
- mysettings["PORTAGE_COLORMAP"] = "
".join(mycolors)
+ mysettings["PORTAGE_COLORMAP"] = colormap()

if "COLUMNS" not in mysettings:
# Set COLUMNS, in order to prevent unnecessary stty calls
--
1.7.8.5
 
Old 03-11-2012, 06:09 AM
Alec Warner
 
Default portageq: add "colormap" helper

On Sat, Mar 10, 2012 at 8:15 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> *bin/isolated-functions.sh * * * * * * *| * *2 +-
> *bin/portageq * * * * * * * * * * * * * | * *8 ++++++++
> *pym/portage/output.py * * * * * * * * *| * *6 ++++++
> *pym/portage/package/ebuild/doebuild.py | * *8 ++------
> *4 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
> index 9321ad5..98be41e 100644
> --- a/bin/isolated-functions.sh
> +++ b/bin/isolated-functions.sh
> @@ -431,8 +431,8 @@ set_colors() {
> * * * * * * * *BAD=$'e[31;01m'
> * * * * * * * *HILITE=$'e[36;01m'
> * * * * * * * *BRACKET=$'e[34;01m'
> + * * * * * * * NORMAL=$'e[0m'
> * * * *fi
> - * * * NORMAL=$'e[0m'
> *}
>
> *RC_ENDCOL="yes"
> diff --git a/bin/portageq b/bin/portageq
> index 5ecbb21..fcdb9d9 100755
> --- a/bin/portageq
> +++ b/bin/portageq
> @@ -44,6 +44,7 @@ del pym_path
> *from portage import os
> *from portage.eapi import eapi_has_repo_deps
> *from portage.util import writemsg, writemsg_stdout
> +from portage.output import colormap
> *portage.proxy.lazyimport.lazyimport(globals(),
> * * * *'subprocess',
> * * * *'_emerge.Package:Package',
> @@ -685,6 +686,13 @@ def distdir(argv):
> * * * *print(portage.settings["DISTDIR"])
>
>
> +def colormap(argv):
> + * * * """
> + * * * Display the color.map as environment variables.
> + * * * """
> + * * * print(portage.output.colormap())
> +
> +
> *def envvar(argv):
> * * * *"""<variable>+
> * * * *Returns a specific environment variable as exists prior to ebuild.sh.
> diff --git a/pym/portage/output.py b/pym/portage/output.py
> index 43d7503..98bec81 100644
> --- a/pym/portage/output.py
> +++ b/pym/portage/output.py
> @@ -325,6 +325,12 @@ def style_to_ansi_code(style):
> * * * * * * * *ret += codes.get(attr_name, attr_name)
> * * * *return ret
>
> +def colormap():
> + * * * mycolors = []
> + * * * for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET", "NORMAL"):
> + * * * * * * * mycolors.append("%s=$'%s'" % (c, style_to_ansi_code(c)))
> + * * * return "
".join(mycolors)
> +
> *def colorize(color_key, text):
> * * * *global havecolor
> * * * *if havecolor:
> diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
> index c45aa03..4ff3eea 100644
> --- a/pym/portage/package/ebuild/doebuild.py
> +++ b/pym/portage/package/ebuild/doebuild.py
> @@ -50,7 +50,7 @@ from portage.exception import DigestException, FileNotFound,
> * * * *IncorrectParameter, InvalidDependString, PermissionDenied,
> * * * *UnsupportedAPIException
> *from portage.localization import _
> -from portage.output import style_to_ansi_code
> +from portage.output import colormap

I assume style_to_ansi_code is unused?

> *from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs
> *from portage.util import apply_recursive_permissions,
> * * * *apply_secpass_permissions, noiselimit, normalize_path,
> @@ -300,11 +300,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
> * * * * * * * *mysettings["PORTAGE_CONFIGROOT"], EBUILD_SH_ENV_DIR)
>
> * * * *# Allow color.map to control colors associated with einfo, ewarn, etc...
> - * * * mycolors = []
> - * * * for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
> - * * * * * * * mycolors.append("%s=$'%s'" %
> - * * * * * * * * * * * (c, style_to_ansi_code(c)))
> - * * * mysettings["PORTAGE_COLORMAP"] = "
".join(mycolors)
> + * * * mysettings["PORTAGE_COLORMAP"] = colormap()
>
> * * * *if "COLUMNS" not in mysettings:
> * * * * * * * *# Set COLUMNS, in order to prevent unnecessary stty calls
> --
> 1.7.8.5
>
>
 
Old 03-11-2012, 06:27 AM
Mike Frysinger
 
Default portageq: add "colormap" helper

On Sunday 11 March 2012 03:09:05 Alec Warner wrote:
> On Sat, Mar 10, 2012 at 8:15 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > --- a/pym/portage/package/ebuild/doebuild.py
> > +++ b/pym/portage/package/ebuild/doebuild.py
> >
> > -from portage.output import style_to_ansi_code
> > +from portage.output import colormap
>
> I assume style_to_ansi_code is unused?

the only consumer i saw in doebuild.py was converted to colormap
-mike
 
Old 03-11-2012, 02:13 PM
Zac Medico
 
Default portageq: add "colormap" helper

LGTM.
--
Thanks,
Zac
 

Thread Tools




All times are GMT. The time now is 12:40 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org