Refactor how use_color is set in scripts/utils.

This commit is contained in:
Florian Bruhin 2015-12-02 18:14:34 +01:00
parent 7df01440a3
commit f342f129c6

View File

@ -22,20 +22,20 @@
import os
import os.path
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
colorama = None
else:
colorama.init()
use_color = os.name != 'nt' or colorama
fg_colors = {
'black': 30,
'red': 31,