Skip to content

Commit 07e451f

Browse files
authored
Only install colorama on Windows (#249)
1 parent e496c95 commit 07e451f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

knack/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __init__(self,
9898
self.only_show_errors = self.config.getboolean('core', 'only_show_errors', fallback=False)
9999
self.enable_color = self._should_enable_color()
100100
# Init colorama only in Windows legacy terminal
101-
self._should_init_colorama = self.enable_color and os.name == 'nt' and not is_modern_terminal()
101+
self._should_init_colorama = self.enable_color and sys.platform == 'win32' and not is_modern_terminal()
102102

103103
@staticmethod
104104
def _should_show_version(args):

setup.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@
55
# Licensed under the MIT License. See License.txt in the project root for license information.
66
# --------------------------------------------------------------------------------------------
77

8-
from codecs import open
9-
from setuptools import setup, find_packages
8+
import sys
9+
from setuptools import setup
1010

1111
VERSION = '0.8.2'
1212

1313
DEPENDENCIES = [
1414
'argcomplete',
15-
'colorama',
1615
'jmespath',
1716
'pygments',
1817
'pyyaml',
1918
'tabulate'
2019
]
2120

22-
with open('README.rst', 'r', encoding='utf-8') as f:
21+
# On Windows, colorama is required for legacy terminals.
22+
if sys.platform == 'win32':
23+
DEPENDENCIES.append('colorama')
24+
25+
with open('README.rst', 'r') as f:
2326
README = f.read()
2427

2528
setup(

0 commit comments

Comments
 (0)