mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-05 11:02:14 +01:00
Updated for f string
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
c07c9d40de
commit
6439ef4814
1 changed files with 7 additions and 8 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue