diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-04-30 00:25:36 +0200 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-04-30 00:25:36 +0200 |
| commit | 96eda726cfcfea4efe8b5c7e6ce83ef30bc04166 (patch) | |
| tree | 6b020e1880a0efe0fc0fdb23ebdea016bf95f2ed /scripts | |
| parent | d647fda22709e1e969df59258325b78afee6f2a4 (diff) | |
| download | psutil-96eda726cfcfea4efe8b5c7e6ce83ef30bc04166.tar.gz | |
refactoring
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/internal/download_exes.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/scripts/internal/download_exes.py b/scripts/internal/download_exes.py index e607b87d..249b8689 100755 --- a/scripts/internal/download_exes.py +++ b/scripts/internal/download_exes.py @@ -20,7 +20,6 @@ import os import requests import shutil import sys - from concurrent.futures import ThreadPoolExecutor from psutil import __version__ as PSUTIL_VERSION @@ -28,6 +27,7 @@ from psutil import __version__ as PSUTIL_VERSION BASE_URL = 'https://ci.appveyor.com/api' PY_VERSIONS = ['2.7', '3.3', '3.4', '3.5', '3.6'] +COLORS = True def exit(msg): @@ -47,22 +47,23 @@ def term_supports_colors(file=sys.stdout): return True -if term_supports_colors(): - def hilite(s, ok=True, bold=False): - """Return an highlighted version of 'string'.""" - attr = [] - if ok is None: # no color - pass - elif ok: # green - attr.append('32') - else: # red - attr.append('31') - if bold: - attr.append('1') - return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), s) -else: - def hilite(s, *a, **k): +COLORS = term_supports_colors() + + +def hilite(s, ok=True, bold=False): + """Return an highlighted version of 'string'.""" + if not COLORS: return s + attr = [] + if ok is None: # no color + pass + elif ok: # green + attr.append('32') + else: # red + attr.append('31') + if bold: + attr.append('1') + return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), s) def safe_makedirs(path): |
