Skip to content

Commit

Permalink
Merge pull request VUnit#538 from dbhi/fix-color-win
Browse files Browse the repository at this point in the history
fix: use LinuxColorPrinter if MSYSTEM envvar is set
  • Loading branch information
kraigher authored Sep 14, 2019
2 parents ba45c6a + 32338b8 commit 7e38f6f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vunit/color_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Provides capability to print in color to the terminal in both Windows and Linux.
"""

import os
import sys
import ctypes
from ctypes import Structure, c_short, c_ushort, byref
Expand Down Expand Up @@ -196,7 +197,11 @@ def write(text, output_file=None, fg=None, bg=None): # pylint: disable=unused-a


NO_COLOR_PRINTER = NoColorPrinter()
if IS_WINDOWS_SYSTEM:

# On MSYS/MINGW shells (https://www.msys2.org/) with Python installed through pacman, IS_WINDOWS_SYSTEM is true.
# However, regular Linux color strings are supported/required, instead of 'native' windows color format.
# Environment variable MSYSTEM is checked, which should contain 'msys'|'mingw32'|'mingw64' or be unset/empty.
if IS_WINDOWS_SYSTEM and ('MSYSTEM' not in os.environ):
COLOR_PRINTER = Win32ColorPrinter()
else:
COLOR_PRINTER = LinuxColorPrinter()

0 comments on commit 7e38f6f

Please sign in to comment.