From bd11913a4ae377ebc399fca6a1af4d40e2ca82bc Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 22 Sep 2014 20:31:54 +0200 Subject: [PATCH] Add colorama to scripts.utils --- scripts/utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/utils.py b/scripts/utils.py index 0c66814a1..daa3a7dcc 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -19,10 +19,22 @@ """Utility functions for scripts.""" +import os use_color = True +# Import side-effects are an evil thing, but here it's okay so scripts using +# colors work on Windows as well. +try: + import colorama +except ImportError: + if os.name == 'nt': + use_color = False +else: + colorama.init() + + fg_colors = { 'black': 30, 'red': 31,