* cartman special today:
- search_package API - extracting notification for install
This commit is contained in:
+10
@@ -243,6 +243,16 @@ def info_name(package_name):
|
|||||||
else:
|
else:
|
||||||
raise Error(_('Package %s not found') % package_name)
|
raise Error(_('Package %s not found') % package_name)
|
||||||
|
|
||||||
|
def search_package(terms, lang = None):
|
||||||
|
if not lang:
|
||||||
|
lang = pisi.pxml.autoxml.LocalText.get_lang()
|
||||||
|
def search(self, id, terms):
|
||||||
|
return pisi.search.query(id, lang, terms)
|
||||||
|
r1 = pisi.search.query('summary', lang, terms)
|
||||||
|
r2 = pisi.search.query('description', lang, terms)
|
||||||
|
r = r1.union(r2)
|
||||||
|
return r
|
||||||
|
|
||||||
def index(dirs, output = 'pisi-index.xml'):
|
def index(dirs, output = 'pisi-index.xml'):
|
||||||
index = Index()
|
index = Index()
|
||||||
if not dirs:
|
if not dirs:
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class Install(AtomicOperation):
|
|||||||
def extract_install(self):
|
def extract_install(self):
|
||||||
"unzip package in place"
|
"unzip package in place"
|
||||||
|
|
||||||
ctx.ui.info(_('Extracting files'))
|
ctx.ui.notify(pisi.ui.extracting, package = self.pkginfo, files = self.files)
|
||||||
self.package.extract_dir_flat('install', ctx.config.dest_dir())
|
self.package.extract_dir_flat('install', ctx.config.dest_dir())
|
||||||
|
|
||||||
if self.reinstall:
|
if self.reinstall:
|
||||||
|
|||||||
@@ -136,8 +136,10 @@ class CLI(UI):
|
|||||||
msg = _('Removed %s') % keywords['package'].name
|
msg = _('Removed %s') % keywords['package'].name
|
||||||
elif event == ui.upgraded:
|
elif event == ui.upgraded:
|
||||||
msg = _('Upgraded %s') % keywords['package'].name
|
msg = _('Upgraded %s') % keywords['package'].name
|
||||||
if event == ui.configured:
|
elif event == ui.configured:
|
||||||
msg = _('Configured %s') % keywords['package'].name
|
msg = _('Configured %s') % keywords['package'].name
|
||||||
|
elif event == ui.extracting:
|
||||||
|
msg = _('Extracting the files of %s') % keywords['package'].name
|
||||||
else:
|
else:
|
||||||
msg = None
|
msg = None
|
||||||
if msg:
|
if msg:
|
||||||
|
|||||||
+1
-10
@@ -975,15 +975,6 @@ Finds a package in repository containing specified search terms
|
|||||||
lang = 'en'
|
lang = 'en'
|
||||||
return lang
|
return lang
|
||||||
|
|
||||||
def search_package(terms, lang = None):
|
|
||||||
if not lang:
|
|
||||||
lang = pisi.pxml.autoxml.LocalText.get_lang()
|
|
||||||
def search(self, id, terms):
|
|
||||||
return pisi.search.query(id, lang, terms)
|
|
||||||
r1 = pisi.search.query('summary', lang, terms)
|
|
||||||
r2 = pisi.search.query('description', lang, terms)
|
|
||||||
r = r1.union(r2)
|
|
||||||
return r
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
@@ -993,7 +984,7 @@ Finds a package in repository containing specified search terms
|
|||||||
self.help()
|
self.help()
|
||||||
return
|
return
|
||||||
|
|
||||||
r = search_package(self.args, self.get_lang())
|
r = pisi.api.search_package(self.args, self.get_lang())
|
||||||
|
|
||||||
for pkg in r:
|
for pkg in r:
|
||||||
self.printinfo_package(pkg)
|
self.printinfo_package(pkg)
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ import pisi
|
|||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
|
|
||||||
(installed, upgraded, removed, installing, removing,
|
(installed, upgraded, removed, installing, removing,
|
||||||
configuring, configured) = range(7)
|
configuring, configured, extracting) = range(8)
|
||||||
|
|
||||||
class UI(object):
|
class UI(object):
|
||||||
"Abstract class for UI operations, derive from this."
|
"Abstract class for UI operations, derive from this."
|
||||||
|
|||||||
Reference in New Issue
Block a user