PackageInfo: Avoid newlines getting in output.

This commit is contained in:
Krytarik Raido 2020-12-03 01:23:04 +01:00
parent fa6be1af5a
commit 5753ecf12d
3 changed files with 5 additions and 11 deletions

View File

@ -22,7 +22,7 @@ import supybot
import supybot.world as world
from imp import reload
__version__ = "2.0.1"
__version__ = "2.1.0"
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@gmail.com")
__contributors__ = {
supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Concept'],

View File

@ -75,7 +75,6 @@ deb-src deb http://security.debian.org/ %s/updates main contrib non-free
'oldstable', 'stable', 'unstable', 'testing', 'experimental'])
pluginDir = os.path.abspath(os.path.dirname(__file__))
update_apt = os.path.join(pluginDir, 'update_apt')
update_apt_file = os.path.join(pluginDir, 'update_apt_file')
default_dists.add(defaultRelease)
@ -126,11 +125,6 @@ deb-src deb http://security.debian.org/ %s/updates main contrib non-free
if subprocess.getstatusoutput('which apt-file') != 0:
output("You need to install apt-file in order to use the !find command of this plugin")
else:
if yn("In order for the !find command to work, you must run the 'update_apt_file' script, do you want to do this now?", default=True):
os.environ['DIR'] = aptdir # the update_apt_file script checks if DIR is set and uses it if it is
if subprocess.getstatusoutput(update_apt_file) != 0:
output("There was an error running update_apt_file, please run '%s -v' to get more information" % update_apt_file)
PackageInfo = conf.registerPlugin('PackageInfo')
conf.registerChannelValue(PackageInfo, 'enabled',

View File

@ -172,7 +172,7 @@ class Apt:
return maxp
if isSource:
return "%s (%s, %s): Packages %s. Maintained by %s%s" % (
maxp['Package'], maxp['Version'], distro, maxp['Binary'],
maxp['Package'], maxp['Version'], distro, maxp['Binary'].replace('\n',''),
re.sub(r' <\S+>$', '', maxp.get('Original-Maintainer', maxp['Maintainer'])),
" @ %s" % maxp['Vcs'] if maxp['Vcs'] else "")
return "{} ({}, {}): {}. In component {}, is {}. Built by {}. Size {:,} kB / {:,} kB{}".format(
@ -186,10 +186,10 @@ class Apt:
return maxp
if isSource:
return "%s (%s, %s): Build depends on %s" % (
maxp['Package'], maxp['Version'], distro, maxp.get('Builddeps', "nothing"))
maxp['Package'], maxp['Version'], distro, maxp.get('Builddeps', "nothing").replace('\n',''))
return "%s (%s, %s): Depends on %s%s" % (
maxp['Package'], maxp['Version'], distro, maxp.get('Depends', "nothing"),
". Recommends %s" % maxp['Recommends'] if maxp.get('Recommends') else "")
maxp['Package'], maxp['Version'], distro, maxp.get('Depends', "nothing").replace('\n',''),
". Recommends %s" % maxp['Recommends'].replace('\n','') if maxp.get('Recommends') else "")
# Simple test
if __name__ == "__main__":