If python-apt isn't installed (like on some non-debian systems) then just disable package search and lookup
This commit is contained in:
parent
8401c7f03f
commit
06814d02cd
|
@ -26,8 +26,12 @@ if sys.version_info >= (2, 5, 0)
|
||||||
else:
|
else:
|
||||||
import sre as re
|
import sre as re
|
||||||
|
|
||||||
import packages
|
try:
|
||||||
reload(packages)
|
import packages
|
||||||
|
reload(packages)
|
||||||
|
have_packages = True
|
||||||
|
except ImportError:
|
||||||
|
have_packages = False
|
||||||
|
|
||||||
# Simple wrapper class for factoids
|
# Simple wrapper class for factoids
|
||||||
class Factoid:
|
class Factoid:
|
||||||
|
@ -76,7 +80,10 @@ class Encyclopedia(callbacks.Plugin):
|
||||||
self.times = {}
|
self.times = {}
|
||||||
self.seens = {}
|
self.seens = {}
|
||||||
self.distros = []
|
self.distros = []
|
||||||
self.Apt = packages.Apt(self)
|
if have_packages:
|
||||||
|
self.Apt = packages.Apt(self)
|
||||||
|
else:
|
||||||
|
self.log.warning("Faild to import packages, you probably don't have python-apt installed")
|
||||||
self.edits = {}
|
self.edits = {}
|
||||||
self.alert = False
|
self.alert = False
|
||||||
|
|
||||||
|
@ -359,7 +366,7 @@ class Encyclopedia(callbacks.Plugin):
|
||||||
ret = self.factoid_lookup(text, channel, display_info)
|
ret = self.factoid_lookup(text, channel, display_info)
|
||||||
|
|
||||||
# Fall through to package lookup
|
# Fall through to package lookup
|
||||||
if self.registryValue('packagelookup') and (not ret or not len(ret)):
|
if have_packages and self.registryValue('packagelookup') and (not ret or not len(ret)):
|
||||||
text, target, retmsg = self.get_target(msg.nick, orig_text.lower(), target)
|
text, target, retmsg = self.get_target(msg.nick, orig_text.lower(), target)
|
||||||
if text.startswith('info '):
|
if text.startswith('info '):
|
||||||
ret = self.Apt.info(text[5:].strip(),self.registryValue('searchorder', channel).split())
|
ret = self.Apt.info(text[5:].strip(),self.registryValue('searchorder', channel).split())
|
||||||
|
|
Loading…
Reference in New Issue