From 9b040767d5a2d23710c4aebb85d17775fe742a02 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 4 May 2023 09:13:58 +0300 Subject: [PATCH] Updated for description --- slpkg/update_repository.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/slpkg/update_repository.py b/slpkg/update_repository.py index e0fe24d4..526e7566 100644 --- a/slpkg/update_repository.py +++ b/slpkg/update_repository.py @@ -725,13 +725,16 @@ class UpdateRepository(Configs): @staticmethod def read_short_description(path: Path, name: str) -> str: """ Returns the short description. """ - with open(Path(path, 'slack-desc'), 'r') as f: - slack = f.readlines() + slack_desc: Path = Path(path, 'slack-desc') + if slack_desc.is_file(): + with open(slack_desc, 'r') as f: + slack = f.readlines() - for line in slack: - pattern: str = f'{name}: {name}' - if line.startswith(pattern): - return line[len(name) + 1:].strip() + for line in slack: + pattern: str = f'{name}: {name}' + if line.startswith(pattern): + return line[len(name) + 1:].strip() + return '' @staticmethod def read_info_file(info_file: Path, start: str, stop: str) -> list: