1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-09-19 22:33:25 +01:00

Moved Colorama boilerplate to ansi.py.

This commit is contained in:
Markus Birth 2018-02-03 02:15:29 +01:00
parent 34ba8a0db0
commit 9920c13582
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
8 changed files with 11 additions and 24 deletions

View File

@ -9,8 +9,6 @@ import tcllib.argparser
from tcllib import ansi from tcllib import ansi
from requests.exceptions import RequestException, Timeout from requests.exceptions import RequestException, Timeout
tcllib.make_escapes_work()
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.serid = "3531510" fc.serid = "3531510"
fc.fv = "AAA000" fc.fv = "AAA000"

View File

@ -11,8 +11,6 @@ import tcllib.argparser
from tcllib import ansi from tcllib import ansi
from requests.exceptions import RequestException from requests.exceptions import RequestException
tcllib.make_escapes_work()
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.serid = "3531510" fc.serid = "3531510"
#fc.osvs = "7.1.1" #fc.osvs = "7.1.1"

View File

@ -10,8 +10,6 @@ import tcllib.argparser
from tcllib import ansi from tcllib import ansi
from requests.exceptions import RequestException, Timeout from requests.exceptions import RequestException, Timeout
tcllib.make_escapes_work()
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.serid = "3531510" fc.serid = "3531510"
fc.fv = "AAA000" fc.fv = "AAA000"

View File

@ -13,8 +13,6 @@ from requests.exceptions import RequestException, Timeout
# Variants to scan for # Variants to scan for
SCAN_VARIANTS = ["001", "003", "009", "010", "700"] SCAN_VARIANTS = ["001", "003", "009", "010", "700"]
tcllib.make_escapes_work()
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.serid = "3531510" fc.serid = "3531510"
fc.fv = "AAA000" fc.fv = "AAA000"

View File

@ -9,8 +9,6 @@ import tcllib.argparser
from tcllib import ansi from tcllib import ansi
from requests.exceptions import RequestException, Timeout from requests.exceptions import RequestException, Timeout
tcllib.make_escapes_work()
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.serid = "3531510" fc.serid = "3531510"
fc.mode = fc.MODE.OTA fc.mode = fc.MODE.OTA

View File

@ -9,8 +9,6 @@ import sys
import tcllib import tcllib
from requests.exceptions import RequestException from requests.exceptions import RequestException
tcllib.make_escapes_work()
# 1. Fetch list of missing OTAs (e.g. from ancient versions to current) # 1. Fetch list of missing OTAs (e.g. from ancient versions to current)
# 2. Query updates from FOTA servers (and store XML) # 2. Query updates from FOTA servers (and store XML)
# (3. Upload will be done manually with upload_logs.py) # (3. Upload will be done manually with upload_logs.py)

View File

@ -3,7 +3,6 @@
# pylint: disable=C0111,C0326 # pylint: disable=C0111,C0326
import enum import enum
import platform
import requests import requests
from . import credentials from . import credentials
from . import devlist from . import devlist
@ -15,17 +14,6 @@ from . import tclchecksum
from . import tclencheader from . import tclencheader
from . import xmltools 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): def default_enum(enumname, vardict):
return enum.IntEnum(enumname, vardict, module=__name__, qualname="tcllib.FotaCheck.{}".format(enumname)) return enum.IntEnum(enumname, vardict, module=__name__, qualname="tcllib.FotaCheck.{}".format(enumname))

View File

@ -1,5 +1,16 @@
# -*- coding: utf-8 -*- # -*- 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" UP_DEL = u"\u001b[F\u001b[K"
BLACK = u"\u001b[0;30m" BLACK = u"\u001b[0;30m"
RED_DARK = u"\u001b[0;31m" RED_DARK = u"\u001b[0;31m"