diff options
author | Carl George <carl@george.computer> | 2017-07-26 16:50:38 -0500 |
---|---|---|
committer | Joffrey F <f.joffrey@gmail.com> | 2017-08-21 13:09:19 -0700 |
commit | bbebf518cfc9b975f04883ef4b3a9a89c071eab2 (patch) | |
tree | 79f1e8875c5108a02aa6aff92302e404ad292fd8 | |
parent | e0f7b075b8c02b40da3e58757d6bf6bc7e9588ed (diff) |
only require colorama on windows
Colorama is only useful on Windows by design. Since it has no effect on
other platforms, it makes sense to not require it universally.
Signed-off-by: Carl George <carl@george.computer>
-rw-r--r-- | compose/cli/colors.py | 6 | ||||
-rw-r--r-- | requirements.txt | 2 | ||||
-rw-r--r-- | setup.py | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/compose/cli/colors.py b/compose/cli/colors.py index f1251e43..cb30e361 100644 --- a/compose/cli/colors.py +++ b/compose/cli/colors.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from __future__ import unicode_literals -import colorama +from ..const import IS_WINDOWS_PLATFORM NAMES = [ 'grey', @@ -33,7 +33,9 @@ def make_color_fn(code): return lambda s: ansi_color(code, s) -colorama.init(strip=False) +if IS_WINDOWS_PLATFORM: + import colorama + colorama.init(strip=False) for (name, code) in get_pairs(): globals()[name] = make_color_fn(code) diff --git a/requirements.txt b/requirements.txt index 844921ff..81dcdf08 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ backports.ssl-match-hostname==3.5.0.1; python_version < '3' cached-property==1.3.0 certifi==2017.4.17 chardet==3.0.4 -colorama==0.3.9 +colorama==0.3.9; sys_platform == 'win32' docker==2.4.2 docker-pycreds==0.2.1 dockerpty==0.4.1 @@ -31,7 +31,6 @@ def find_version(*file_paths): install_requires = [ 'cached-property >= 1.2.0, < 2', - 'colorama >= 0.3.7, < 0.4', 'docopt >= 0.6.1, < 0.7', 'PyYAML >= 3.10, < 4', 'requests >= 2.6.1, != 2.11.0, < 2.12', @@ -56,6 +55,7 @@ extras_require = { ':python_version < "3.4"': ['enum34 >= 1.0.4, < 2'], ':python_version < "3.5"': ['backports.ssl_match_hostname >= 3.5'], ':python_version < "3.3"': ['ipaddress >= 1.0.16'], + ':sys_platform == "win32"': ['colorama >= 0.3.7, < 0.4'], 'socks': ['PySocks >= 1.5.6, != 1.5.7, < 2'], } |