Refactor how use_color is set in scripts/utils.
This commit is contained in:
parent
7df01440a3
commit
f342f129c6
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user