Updated for f string

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2020-01-20 20:43:50 +01:00
parent c07c9d40de
commit 6439ef4814

View file

@ -30,25 +30,24 @@ from slpkg.__metadata__ import MetaData as _meta_
def check_md5(pkg_md5, src_file): def check_md5(pkg_md5, src_file):
"""MD5 Checksum """MD5 Checksum
""" """
red = _meta_.color["RED"]
green = _meta_.color["GREEN"]
endc = _meta_.color["ENDC"]
if _meta_.checkmd5 in ["on", "ON"]: if _meta_.checkmd5 in ["on", "ON"]:
print() print()
md5s = md5(src_file) md5s = md5(src_file)
if pkg_md5 != md5s: if pkg_md5 != md5s:
Msg().template(78) Msg().template(78)
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format( print(f"| MD5SUM check for {src_file.split('/')[-1]} [ {red}FAILED{endc} ]")
src_file.split("/")[-1], _meta_.color["RED"],
_meta_.color["ENDC"]))
Msg().template(78) Msg().template(78)
print("| Expected: {0}".format(pkg_md5)) print(f"| Expected: {pkg_md5}")
print("| Found: {0}".format(md5s)) print(f"| Found: {md5s}")
Msg().template(78) Msg().template(78)
print() print()
if not Msg().answer() in ["y", "Y"]: if not Msg().answer() in ["y", "Y"]:
raise SystemExit() raise SystemExit()
else: else:
Msg().template(78) Msg().template(78)
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format( print(f"| MD5SUM check for {src_file.split('/')[-1]} [ {green}PASSED{endc} ]")
src_file.split("/")[-1], _meta_.color["GREEN"],
_meta_.color["ENDC"]))
Msg().template(78) Msg().template(78)
print() # new line after pass checksum print() # new line after pass checksum