From 6a3dc46f995a0f6afef6767f9de84c0ba0b02da8 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 18 Sep 2015 02:19:12 +0300 Subject: [PATCH] Fix package deskcription --- slpkg/desc.py | 32 +++++++++++++------------------- slpkg/sbo/network.py | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/slpkg/desc.py b/slpkg/desc.py index 5f274056..1db69f48 100644 --- a/slpkg/desc.py +++ b/slpkg/desc.py @@ -26,6 +26,8 @@ from slpkg.utils import Utils from slpkg.messages import Msg from slpkg.__metadata__ import MetaData as _meta_ +from slpkg.sbo.greps import SBoGrep + class PkgDesc(object): """Print package description from the repository @@ -50,34 +52,26 @@ class PkgDesc(object): if self.repo in self.meta.repositories and self.repo != "sbo": self.lib = self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format( self.repo) - else: - self.lib = self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format( - self.repo) def view(self): """Print package description by repository """ - PACKAGES_TXT = Utils().read_file(self.lib) print("") # new line at start - count = 0 - if self.repo != "sbo": + description, count = "", 0 + if self.repo == "sbo": + description = SBoGrep(self.name).description() + else: + PACKAGES_TXT = Utils().read_file(self.lib) for line in PACKAGES_TXT.splitlines(): if line.startswith(self.name + ":"): - print("{0}{1}{2}".format(self.COLOR, - line[len(self.name) + 1:], - self.meta.color["ENDC"])) + description += line[len(self.name) + 2:] + "\n" count += 1 if count == 11: break + if description: + print("{0}{1}{2}".format(self.COLOR, description, + self.meta.color["ENDC"])) else: - for line in PACKAGES_TXT.splitlines(): - if (line.startswith( - "SLACKBUILD SHORT DESCRIPTION: " + self.name + " (")): - count += 1 - print("{0}{1}{2}".format(self.COLOR, - line[31:], - self.meta.color["ENDC"])) - if count == 0: self.msg.pkg_not_found("", self.name, "No matching", "\n") - else: - print("") # new line at end + if description and self.repo == "sbo": + print("") diff --git a/slpkg/sbo/network.py b/slpkg/sbo/network.py index 3fd465fa..faa6d0fb 100644 --- a/slpkg/sbo/network.py +++ b/slpkg/sbo/network.py @@ -45,7 +45,7 @@ from slpkg.sbo.compressed import SBoLink from slpkg.sbo.search import sbo_search_pkg from slpkg.sbo.slack_find import slack_package -from slack.slack_version import slack_ver +from slpkg.slack.slack_version import slack_ver class SBoNetwork(object):