diff options
author | UK992 <urbankrajnc92@gmail.com> | 2016-08-13 03:13:01 +0200 |
---|---|---|
committer | UK992 <urbankrajnc92@gmail.com> | 2016-08-13 03:20:47 +0200 |
commit | fed0e94ec6d4ac630fa641e32644a7e055e2e6f0 (patch) | |
tree | a82aa26babd21c290b37ca40e7db8cd5a6edcc81 /python | |
parent | 9a3b61abe1ad633ab723ca6cbb7180a4992ead5a (diff) | |
download | servo-fed0e94ec6d4ac630fa641e32644a7e055e2e6f0.tar.gz servo-fed0e94ec6d4ac630fa641e32644a7e055e2e6f0.zip |
Add support colored text in Windows Console
Diffstat (limited to 'python')
-rw-r--r-- | python/requirements.txt | 3 | ||||
-rw-r--r-- | python/tidy/servo_tidy/tidy.py | 3 | ||||
-rw-r--r-- | python/tidy/setup.py | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/python/requirements.txt b/python/requirements.txt index c57a74825da..97487c76aff 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -14,4 +14,7 @@ pyflakes == 0.8.1 # For test-webidl ply == 3.8 +# For Cross-platform colored terminal text +colorama == 0.3.7 + -e python/tidy diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 93b5d8f6452..eb22f98a6b3 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -18,6 +18,7 @@ import StringIO import subprocess import sys from licenseck import MPL, APACHE, COPYRIGHT, licenses_toml, licenses_dep_toml +import colorama COMMENTS = ["// ", "# ", " *", "/* "] @@ -785,8 +786,10 @@ def scan(only_changed_files=False, progress=True): errors = itertools.chain(errors, dep_license_errors, wpt_lint_errors) error = None for error in errors: + colorama.init() print "\r\033[94m{}\033[0m:\033[93m{}\033[0m: \033[91m{}\033[0m".format(*error) print if error is None: + colorama.init() print "\033[92mtidy reported no errors.\033[0m" return int(error is not None) diff --git a/python/tidy/setup.py b/python/tidy/setup.py index dbff59e7964..80d2140f3ec 100644 --- a/python/tidy/setup.py +++ b/python/tidy/setup.py @@ -16,6 +16,7 @@ VERSION = '0.1.0' install_requires = [ "flake8==2.4.1", "toml==0.9.1", + "colorama==0.3.7", ] here = os.path.dirname(os.path.abspath(__file__)) |