mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Fix package deskcription
This commit is contained in:
parent
0d3d1707fa
commit
6a3dc46f99
2 changed files with 14 additions and 20 deletions
|
@ -26,6 +26,8 @@ from slpkg.utils import Utils
|
||||||
from slpkg.messages import Msg
|
from slpkg.messages import Msg
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
from slpkg.sbo.greps import SBoGrep
|
||||||
|
|
||||||
|
|
||||||
class PkgDesc(object):
|
class PkgDesc(object):
|
||||||
"""Print package description from the repository
|
"""Print package description from the repository
|
||||||
|
@ -50,34 +52,26 @@ class PkgDesc(object):
|
||||||
if self.repo in self.meta.repositories and self.repo != "sbo":
|
if self.repo in self.meta.repositories and self.repo != "sbo":
|
||||||
self.lib = self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format(
|
self.lib = self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format(
|
||||||
self.repo)
|
self.repo)
|
||||||
else:
|
|
||||||
self.lib = self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(
|
|
||||||
self.repo)
|
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
"""Print package description by repository
|
"""Print package description by repository
|
||||||
"""
|
"""
|
||||||
PACKAGES_TXT = Utils().read_file(self.lib)
|
|
||||||
print("") # new line at start
|
print("") # new line at start
|
||||||
count = 0
|
description, count = "", 0
|
||||||
if self.repo != "sbo":
|
if self.repo == "sbo":
|
||||||
|
description = SBoGrep(self.name).description()
|
||||||
|
else:
|
||||||
|
PACKAGES_TXT = Utils().read_file(self.lib)
|
||||||
for line in PACKAGES_TXT.splitlines():
|
for line in PACKAGES_TXT.splitlines():
|
||||||
if line.startswith(self.name + ":"):
|
if line.startswith(self.name + ":"):
|
||||||
print("{0}{1}{2}".format(self.COLOR,
|
description += line[len(self.name) + 2:] + "\n"
|
||||||
line[len(self.name) + 1:],
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
count += 1
|
count += 1
|
||||||
if count == 11:
|
if count == 11:
|
||||||
break
|
break
|
||||||
|
if description:
|
||||||
|
print("{0}{1}{2}".format(self.COLOR, description,
|
||||||
|
self.meta.color["ENDC"]))
|
||||||
else:
|
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")
|
self.msg.pkg_not_found("", self.name, "No matching", "\n")
|
||||||
else:
|
if description and self.repo == "sbo":
|
||||||
print("") # new line at end
|
print("")
|
||||||
|
|
|
@ -45,7 +45,7 @@ from slpkg.sbo.compressed import SBoLink
|
||||||
from slpkg.sbo.search import sbo_search_pkg
|
from slpkg.sbo.search import sbo_search_pkg
|
||||||
from slpkg.sbo.slack_find import slack_package
|
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):
|
class SBoNetwork(object):
|
||||||
|
|
Loading…
Add table
Reference in a new issue