diff --git a/tclcheck_allfull.py b/tclcheck_allfull.py index a277a9f..c11c0dc 100644 --- a/tclcheck_allfull.py +++ b/tclcheck_allfull.py @@ -9,8 +9,6 @@ import tcllib.argparser from tcllib import ansi from requests.exceptions import RequestException, Timeout -tcllib.make_escapes_work() - fc = tcllib.FotaCheck() fc.serid = "3531510" fc.fv = "AAA000" diff --git a/tclcheck_allota.py b/tclcheck_allota.py index 5e7b754..3d7a5ab 100644 --- a/tclcheck_allota.py +++ b/tclcheck_allota.py @@ -11,8 +11,6 @@ import tcllib.argparser from tcllib import ansi from requests.exceptions import RequestException -tcllib.make_escapes_work() - fc = tcllib.FotaCheck() fc.serid = "3531510" #fc.osvs = "7.1.1" diff --git a/tclcheck_findprd.py b/tclcheck_findprd.py index 82c9431..981625b 100755 --- a/tclcheck_findprd.py +++ b/tclcheck_findprd.py @@ -10,8 +10,6 @@ import tcllib.argparser from tcllib import ansi from requests.exceptions import RequestException, Timeout -tcllib.make_escapes_work() - fc = tcllib.FotaCheck() fc.serid = "3531510" fc.fv = "AAA000" diff --git a/tclcheck_findprd2.py b/tclcheck_findprd2.py index dc4712a..940c281 100644 --- a/tclcheck_findprd2.py +++ b/tclcheck_findprd2.py @@ -13,8 +13,6 @@ from requests.exceptions import RequestException, Timeout # Variants to scan for SCAN_VARIANTS = ["001", "003", "009", "010", "700"] -tcllib.make_escapes_work() - fc = tcllib.FotaCheck() fc.serid = "3531510" fc.fv = "AAA000" diff --git a/tclcheck_findver.py b/tclcheck_findver.py index d09627c..2a72960 100755 --- a/tclcheck_findver.py +++ b/tclcheck_findver.py @@ -9,8 +9,6 @@ import tcllib.argparser from tcllib import ansi from requests.exceptions import RequestException, Timeout -tcllib.make_escapes_work() - fc = tcllib.FotaCheck() fc.serid = "3531510" fc.mode = fc.MODE.OTA diff --git a/tclcheck_gapfill.py b/tclcheck_gapfill.py index f6694dc..c85f813 100644 --- a/tclcheck_gapfill.py +++ b/tclcheck_gapfill.py @@ -9,8 +9,6 @@ import sys import tcllib from requests.exceptions import RequestException -tcllib.make_escapes_work() - # 1. Fetch list of missing OTAs (e.g. from ancient versions to current) # 2. Query updates from FOTA servers (and store XML) # (3. Upload will be done manually with upload_logs.py) diff --git a/tcllib/__init__.py b/tcllib/__init__.py index c60ec4e..69b378e 100644 --- a/tcllib/__init__.py +++ b/tcllib/__init__.py @@ -3,7 +3,6 @@ # pylint: disable=C0111,C0326 import enum -import platform import requests from . import credentials from . import devlist @@ -15,17 +14,6 @@ from . import tclchecksum from . import tclencheader from . import xmltools -def make_escapes_work(): - system = platform.system() - if system == "Windows": - try: - import colorama - except ImportError: - pass - else: - colorama.init() - - def default_enum(enumname, vardict): return enum.IntEnum(enumname, vardict, module=__name__, qualname="tcllib.FotaCheck.{}".format(enumname)) diff --git a/tcllib/ansi.py b/tcllib/ansi.py index 590bfb8..7ad5416 100644 --- a/tcllib/ansi.py +++ b/tcllib/ansi.py @@ -1,5 +1,16 @@ # -*- coding: utf-8 -*- +import platform + +# Needed to make ANSI escape sequences work in Windows +system = platform.system() +if system == "Windows": + try: + import colorama + colorama.init() + except ImportError: + pass + UP_DEL = u"\u001b[F\u001b[K" BLACK = u"\u001b[0;30m" RED_DARK = u"\u001b[0;31m"