Skip to content

Commit

Permalink
Only install colorama on Windows (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasli authored Nov 4, 2021
1 parent e496c95 commit 07e451f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion knack/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(self,
self.only_show_errors = self.config.getboolean('core', 'only_show_errors', fallback=False)
self.enable_color = self._should_enable_color()
# Init colorama only in Windows legacy terminal
self._should_init_colorama = self.enable_color and os.name == 'nt' and not is_modern_terminal()
self._should_init_colorama = self.enable_color and sys.platform == 'win32' and not is_modern_terminal()

@staticmethod
def _should_show_version(args):
Expand Down
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from codecs import open
from setuptools import setup, find_packages
import sys
from setuptools import setup

VERSION = '0.8.2'

DEPENDENCIES = [
'argcomplete',
'colorama',
'jmespath',
'pygments',
'pyyaml',
'tabulate'
]

with open('README.rst', 'r', encoding='utf-8') as f:
# On Windows, colorama is required for legacy terminals.
if sys.platform == 'win32':
DEPENDENCIES.append('colorama')

with open('README.rst', 'r') as f:
README = f.read()

setup(
Expand Down

0 comments on commit 07e451f

Please sign in to comment.