1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-09 22:06:47 +00:00

Moved ANSI_UP_DEL to tcllib.

This commit is contained in:
Markus Birth 2017-09-27 00:39:19 +02:00
parent c7f3e7bcaa
commit 095ba8cebb
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
4 changed files with 7 additions and 9 deletions

View File

@ -7,7 +7,6 @@ import tcllib
from requests.exceptions import RequestException, Timeout from requests.exceptions import RequestException, Timeout
tcllib.make_escapes_work() tcllib.make_escapes_work()
ANSI_UP_DEL = u"\u001b[F\u001b[K"
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.serid = "3531510" fc.serid = "3531510"
@ -38,7 +37,7 @@ while len(prds) > 0:
prds.pop(0) prds.pop(0)
except Timeout as e: except Timeout as e:
print("{} failed. (Connection timed out.)".format(prd)) print("{} failed. (Connection timed out.)".format(prd))
print(ANSI_UP_DEL, end="") print(tcllib.ANSI_UP_DEL, end="")
continue continue
except (SystemExit, RequestException) as e: except (SystemExit, RequestException) as e:
print("{} failed. ({})".format(prd, str(e))) print("{} failed. ({})".format(prd, str(e)))
@ -46,5 +45,5 @@ while len(prds) > 0:
# No update available or invalid request - remove from queue # No update available or invalid request - remove from queue
prds.pop(0) prds.pop(0)
else: else:
print(ANSI_UP_DEL, end="") print(tcllib.ANSI_UP_DEL, end="")
continue continue

View File

@ -7,7 +7,6 @@ import tcllib
from requests.exceptions import RequestException, Timeout from requests.exceptions import RequestException, Timeout
tcllib.make_escapes_work() tcllib.make_escapes_work()
ANSI_UP_DEL = u"\u001b[F\u001b[K"
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.serid = "3531510" fc.serid = "3531510"
@ -38,7 +37,7 @@ while len(prds) > 0:
prds.pop(0) prds.pop(0)
except Timeout as e: except Timeout as e:
print("{} failed. (Connection timed out.)".format(prd)) print("{} failed. (Connection timed out.)".format(prd))
print(ANSI_UP_DEL, end="") print(tcllib.ANSI_UP_DEL, end="")
continue continue
except (SystemExit, RequestException) as e: except (SystemExit, RequestException) as e:
print("{} failed. ({})".format(prd, str(e))) print("{} failed. ({})".format(prd, str(e)))
@ -46,5 +45,5 @@ while len(prds) > 0:
# No update available or invalid request - remove from queue # No update available or invalid request - remove from queue
prds.pop(0) prds.pop(0)
else: else:
print(ANSI_UP_DEL, end="") print(tcllib.ANSI_UP_DEL, end="")
continue continue

View File

@ -7,7 +7,6 @@ import tcllib
from requests.exceptions import RequestException, Timeout from requests.exceptions import RequestException, Timeout
tcllib.make_escapes_work() tcllib.make_escapes_work()
ANSI_UP_DEL = u"\u001b[F\u001b[K"
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.serid = "3531510" fc.serid = "3531510"
@ -36,7 +35,7 @@ while len(prds) > 0:
prds.pop(0) prds.pop(0)
except Timeout as e: except Timeout as e:
print("{} failed. (Connection timed out.)".format(prd)) print("{} failed. (Connection timed out.)".format(prd))
print(ANSI_UP_DEL, end="") print(tcllib.ANSI_UP_DEL, end="")
continue continue
except (SystemExit, RequestException) as e: except (SystemExit, RequestException) as e:
print("{} ({}) failed. ({})".format(prd, lastver, str(e))) print("{} ({}) failed. ({})".format(prd, lastver, str(e)))
@ -44,5 +43,5 @@ while len(prds) > 0:
# No update available or invalid request - remove from queue # No update available or invalid request - remove from queue
prds.pop(0) prds.pop(0)
else: else:
print(ANSI_UP_DEL, end="") print(tcllib.ANSI_UP_DEL, end="")
continue continue

View File

@ -18,6 +18,7 @@ except (ImportError, AttributeError):
from xml.etree import ElementTree from xml.etree import ElementTree
import requests import requests
ANSI_UP_DEL = u"\u001b[F\u001b[K"
def make_escapes_work(): def make_escapes_work():
system = platform.system() system = platform.system()