nerdvegas/rez — pull request #89 by mstreatfield (2014-07-24 03:25:13+00:00)
Title: Update Colorize to Respect TTY on Stream

I discover that, contrary to what I had posted in the original pull request, the colorama module was not handling the absence of a tty correctly, resulting in control characters always being printed.

This pull request fixes that. The log formatter has been replaced with a stream handler that detects tty on the stream and handles the formatting of the record appropriately. The info printed in the resolved context has also been updated to detect tty on the buffer.

Initially, you suggested forcing enable_color in the config to False if tty is not found on sys.stdout, however this is not sufficient. The default StreamHandler used with python logging uses sys.stderr and various points in the rez code allow the caller to provide the stream to use. Therefore the check must be done closer to where the stream being used is specified.

Also, minor bug fix to only append a bootstrap path if one is found. Previously None could be added to the list of paths which would cause an error later.