[PATCH] color: add support for terminfo-based attributes and color

Martin Geisler mg at lazybytes.net
Thu Aug 27 03:39:10 CDT 2009


Danek Duvall <duvall at comfychair.org> writes:

> # HG changeset patch
> # User Danek Duvall <duvall at comfychair.org>
> # Date 1251013866 25200
> # Node ID 0484a8ce8ef49524f212813791abbcfd09e63762
> # Parent  37042e8b3b342b2e380d8be3e3f7692584c92d33
> color: add support for terminfo-based attributes and color
>
>  from mercurial import cmdutil, commands, extensions, error
>  from mercurial.i18n import _
> +try:
> +    import curses
> +except ImportError:
> +    pass

[...]

> +# Mapping from effect name to terminfo attribute name or color number
> +_terminfo_params = {'none': (True, 'sgr0'),
> +                    'black': (False, curses.COLOR_BLACK),

It looks to me like this will break if curses is not imported? You
should probably set 'curses = None' if the import fails, and then test
on curses before using it here and in the rest of the code.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.


More information about the Mercurial-devel mailing list