mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-19 10:27:07 +01:00
Updated for naming
This commit is contained in:
parent
e242261270
commit
8d56d550e6
1 changed files with 3 additions and 4 deletions
|
@ -34,7 +34,7 @@ class Md5sum:
|
||||||
filename = source_file.split('/')[-1]
|
filename = source_file.split('/')[-1]
|
||||||
source_path = Path(path, filename)
|
source_path = Path(path, filename)
|
||||||
|
|
||||||
md5 = self.read_file(source_path)
|
md5 = self.read_binary_file(source_path)
|
||||||
file_check: str = hashlib.md5(md5).hexdigest()
|
file_check: str = hashlib.md5(md5).hexdigest()
|
||||||
checksum = "".join(checksum)
|
checksum = "".join(checksum)
|
||||||
|
|
||||||
|
@ -42,13 +42,12 @@ class Md5sum:
|
||||||
self.ascii.draw_checksum_error_box(filename, checksum, file_check)
|
self.ascii.draw_checksum_error_box(filename, checksum, file_check)
|
||||||
self.view.question()
|
self.view.question()
|
||||||
|
|
||||||
def read_file(self, filename: Union[str, Path]) -> bytes:
|
def read_binary_file(self, filename: Union[str, Path]) -> bytes:
|
||||||
""" Reads the file. """
|
|
||||||
try:
|
try:
|
||||||
with open(filename, 'rb') as f:
|
with open(filename, 'rb') as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
logger = logging.getLogger(LoggingConfig.date_time)
|
logger = logging.getLogger(LoggingConfig.date_time)
|
||||||
logger.exception(f'{self.__class__.__name__}: '
|
logger.exception(f'{self.__class__.__name__}: '
|
||||||
f'{self.__class__.read_file.__name__}')
|
f'{self.__class__.read_binary_file.__name__}')
|
||||||
self.errors.raise_error_message(f"No such file or directory: '{filename}'", exit_status=20)
|
self.errors.raise_error_message(f"No such file or directory: '{filename}'", exit_status=20)
|
||||||
|
|
Loading…
Reference in a new issue