[PackageKit-commit] packagekit: Branch 'master' - 5 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Sep 25 04:18:42 PDT 2008
backends/yum/yumBackend.py | 664 +++++++++++++++----------------
backends/yum/yumComps.py | 50 +-
backends/yum/yumFilter.py | 96 ++--
po/cs.po | 530 ++++++++++++++++---------
python/packagekit/backend.py | 294 +++++++-------
python/packagekit/client.py | 96 ++--
python/packagekit/daemonBackend.py | 364 ++++++++---------
python/packagekit/frontend.py | 768 ++++++++++++++++++-------------------
python/packagekit/misc.py | 77 +--
python/packagekit/package.py | 18
python/packagekit/pkdbus.py | 12
python/packagekit/pkexceptions.py | 50 +-
python/packagekit/progress.py | 8
python/packagekit/pylint.sh | 1
14 files changed, 1575 insertions(+), 1453 deletions(-)
New commits:
commit 3e6f5f985205e4288d4db848789c455c6bc53328
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 25 11:52:02 2008 +0100
trivial: make rpmlint a bit happier with the python packagekit bindings, and fix up a few potential bugs on the way
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 5c40bd4..b93b47c 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -97,7 +97,6 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
except yum.Errors.RepoError, e:
self.error(ERROR_NO_CACHE, str(e))
-
return wrapper
def __init__(self, args, lock=True):
@@ -786,7 +785,6 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
self.yumbase.groupUnremove(grp.groupid)
return pkgs
-
def get_depends(self, filters, package_ids, recursive_text):
'''
Print a list of depends for a given package
@@ -836,7 +834,6 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
if grp_pkgs:
deps_list.extend(grp_pkgs)
-
# add to correct lists
for pkg in deps_list:
if self._is_inst(pkg):
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 7b05a51..ff410d4 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -24,7 +24,6 @@
import sys
import codecs
import traceback
-import locale
import os.path
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
@@ -34,7 +33,7 @@ from enums import *
class PackageKitBaseBackend:
- def __init__(self,cmds):
+ def __init__(self, cmds):
# Setup a custom exception handler
installExceptionHandler(self)
self.cmds = cmds
@@ -51,7 +50,7 @@ class PackageKitBaseBackend:
def isLocked(self):
return self._locked
- def percentage(self,percent=None):
+ def percentage(self, percent=None):
'''
Write progress percentage
@param percent: Progress percentage
@@ -62,7 +61,7 @@ class PackageKitBaseBackend:
print "no-percentage-updates"
sys.stdout.flush()
- def sub_percentage(self,percent=None):
+ def sub_percentage(self, percent=None):
'''
send 'subpercentage' signal : subprogress percentage
@param percent: subprogress percentage
@@ -70,49 +69,49 @@ class PackageKitBaseBackend:
print "subpercentage\t%i" % (percent)
sys.stdout.flush()
- def error(self,err,description,exit=True):
+ def error(self, err, description, exit=True):
'''
send 'error'
@param err: Error Type (ERROR_NO_NETWORK, ERROR_NOT_SUPPORTED, ERROR_INTERNAL_ERROR)
@param description: Error description
- @param exit: exit application with rc=1, if true
+ @param exit: exit application with rc = 1, if true
'''
- print "error\t%s\t%s" % (err,description)
+ print "error\t%s\t%s" % (err, description)
sys.stdout.flush()
if exit:
if self.isLocked():
self.unLock()
sys.exit(1)
- def message(self,typ,msg):
+ def message(self, typ, msg):
'''
send 'message' signal
@param typ: MESSAGE_BROKEN_MIRROR
'''
- print "message\t%s\t%s" % (typ,msg)
+ print "message\t%s\t%s" % (typ, msg)
sys.stdout.flush()
- def package(self,id,status,summary):
+ def package(self, package_id, status, summary):
'''
send 'package' signal
@param info: the enumerated INFO_* string
- @param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
+ @param package_id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
@param summary: The package Summary
'''
- print >> sys.stdout,"package\t%s\t%s\t%s" % (status,id,summary)
+ print >> sys.stdout, "package\t%s\t%s\t%s" % (status, package_id, summary)
sys.stdout.flush()
- def distro_upgrade(self,dtype,name,summary):
+ def distro_upgrade(self, dtype, name, summary):
'''
send 'distro-upgrade' signal
@param dtype: the enumerated DISTRO_UPGRADE_* string
@param name: The distro name, e.g. "fedora-9"
@param summary: The localised distribution name and description
'''
- print >> sys.stdout,"distro-upgrade\t%s\t%s\t%s" % (dtype,name,summary)
+ print >> sys.stdout, "distro-upgrade\t%s\t%s\t%s" % (dtype, name, summary)
sys.stdout.flush()
- def status(self,state):
+ def status(self, state):
'''
send 'status' signal
@param state: STATUS_DOWNLOAD, STATUS_INSTALL, STATUS_UPDATE, STATUS_REMOVE, STATUS_WAIT
@@ -120,16 +119,16 @@ class PackageKitBaseBackend:
print "status\t%s" % (state)
sys.stdout.flush()
- def repo_detail(self,repoid,name,state):
+ def repo_detail(self, repoid, name, state):
'''
send 'repo-detail' signal
@param repoid: The repo id tag
@param state: false is repo is disabled else true.
'''
- print >> sys.stdout,"repo-detail\t%s\t%s\t%s" % (repoid,name,state)
+ print >> sys.stdout, "repo-detail\t%s\t%s\t%s" % (repoid, name, state)
sys.stdout.flush()
- def data(self,data):
+ def data(self, data):
'''
send 'data' signal:
@param data: The current worked on package
@@ -137,38 +136,38 @@ class PackageKitBaseBackend:
print "data\t%s" % (data)
sys.stdout.flush()
- def details(self,id,license,group,desc,url,bytes):
+ def details(self, package_id, package_license, group, desc, url, bytes):
'''
Send 'details' signal
- @param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
- @param license: The license of the package
+ @param package_id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
+ @param package_license: The license of the package
@param group: The enumerated group
@param desc: The multi line package description
@param url: The upstream project homepage
@param bytes: The size of the package, in bytes
'''
- print >> sys.stdout,"details\t%s\t%s\t%s\t%s\t%s\t%ld" % (id,license,group,desc,url,bytes)
+ print >> sys.stdout, "details\t%s\t%s\t%s\t%s\t%s\t%ld" % (package_id, package_license, group, desc, url, bytes)
sys.stdout.flush()
- def files(self,id,file_list):
+ def files(self, package_id, file_list):
'''
Send 'files' signal
@param file_list: List of the files in the package, separated by ';'
'''
- print >> sys.stdout,"files\t%s\t%s" % (id,file_list)
+ print >> sys.stdout, "files\t%s\t%s" % (package_id, file_list)
sys.stdout.flush()
def finished(self):
'''
Send 'finished' signal
'''
- print >> sys.stdout,"finished"
+ print >> sys.stdout, "finished"
sys.stdout.flush()
- def update_detail(self,id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update_text,changelog,state,issued,updated):
+ def update_detail(self, package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text, changelog, state, issued, updated):
'''
Send 'updatedetail' signal
- @param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
+ @param package_id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
@param updates:
@param obsoletes:
@param vendor_url:
@@ -181,19 +180,19 @@ class PackageKitBaseBackend:
@param issued:
@param updated:
'''
- print >> sys.stdout,"updatedetail\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update_text,changelog,state,issued,updated)
+ print >> sys.stdout, "updatedetail\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text, changelog, state, issued, updated)
sys.stdout.flush()
- def require_restart(self,restart_type,details):
+ def require_restart(self, restart_type, details):
'''
Send 'requirerestart' signal
- @param restart_type: RESTART_SYSTEM, RESTART_APPLICATION,RESTART_SESSION
+ @param restart_type: RESTART_SYSTEM, RESTART_APPLICATION, RESTART_SESSION
@param details: Optional details about the restart
'''
- print "requirerestart\t%s\t%s" % (restart_type,details)
+ print "requirerestart\t%s\t%s" % (restart_type, details)
sys.stdout.flush()
- def allow_cancel(self,allow):
+ def allow_cancel(self, allow):
'''
send 'allow-cancel' signal:
@param allow: Allow the current process to be aborted.
@@ -205,20 +204,20 @@ class PackageKitBaseBackend:
print "allow-cancel\t%s" % (data)
sys.stdout.flush()
- def repo_signature_required(self,id,repo_name,key_url,key_userid,key_id,key_fingerprint,key_timestamp,type):
+ def repo_signature_required(self, package_id, repo_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, sig_type):
'''
send 'repo-signature-required' signal:
- @param id: Id of the package needing a signature
+ @param package_id: Id of the package needing a signature
@param repo_name: Name of the repository
@param key_url: URL which the user can use to verify the key
@param key_userid: Key userid
@param key_id: Key ID
@param key_fingerprint: Full key fingerprint
@param key_timestamp: Key timestamp
- @param type: Key type (GPG)
+ @param sig_type: Key type (GPG)
'''
print "repo-signature-required\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (
- id,repo_name,key_url,key_userid,key_id,key_fingerprint,key_timestamp,type
+ package_id, repo_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, sig_type
)
sys.stdout.flush()
@@ -226,198 +225,205 @@ class PackageKitBaseBackend:
# Backend Action Methods
#
- def search_name(self,filters,key):
+ def search_name(self, filters, key):
'''
Implement the {backend}-search-name functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def search_details(self,filters,key):
+ def search_details(self, filters, key):
'''
Implement the {backend}-search-details functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def search_group(self,filters,key):
+ def search_group(self, filters, key):
'''
Implement the {backend}-search-group functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def search_file(self,filters,key):
+ def search_file(self, filters, key):
'''
Implement the {backend}-search-file functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def get_update_detail(self,package_ids_ids):
+ def get_update_detail(self, package_ids_ids):
'''
Implement the {backend}-get-update-detail functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def get_depends(self,filters,package_ids,recursive):
+ def get_depends(self, filters, package_ids, recursive):
'''
Implement the {backend}-get-depends functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def get_packages(self,filters):
+ def get_packages(self, filters):
'''
Implement the {backend}-get-packages functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def get_requires(self,filters,package_ids,recursive):
+ def get_requires(self, filters, package_ids, recursive):
'''
Implement the {backend}-get-requires functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def what_provides(self,filters,provides_type,search):
+ def what_provides(self, filters, provides_type, search):
'''
Implement the {backend}-what-provides functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
def update_system(self):
'''
Implement the {backend}-update-system functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
def refresh_cache(self):
'''
Implement the {backend}-refresh_cache functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def install_packages(self,package_ids):
+ def install_packages(self, package_ids):
'''
Implement the {backend}-install functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def install_files (self,trusted,inst_files):
+ def install_signature(self, sigtype, key_id, package):
+ '''
+ Implement the {backend}-install-signature functionality
+ Needed to be implemented in a sub class
+ '''
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
+
+ def install_files (self, trusted, inst_files):
'''
Implement the {backend}-install_files functionality
Install the package containing the inst_file file
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def service_pack (self,location):
+ def service_pack (self, location):
'''
Implement the {backend}-service-pack functionality
Update the computer from a service pack in location
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def resolve(self,name):
+ def resolve(self, name):
'''
Implement the {backend}-resolve functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def remove_packages(self,allowdep,package_ids):
+ def remove_packages(self, allowdep, package_ids):
'''
Implement the {backend}-remove functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def update_packages(self,package):
+ def update_packages(self, package):
'''
Implement the {backend}-update functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def get_details(self,package):
+ def get_details(self, package):
'''
Implement the {backend}-get-details functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def get_files(self,package):
+ def get_files(self, package):
'''
Implement the {backend}-get-files functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def get_updates(self,filter):
+ def get_updates(self, filters):
'''
Implement the {backend}-get-updates functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
def get_distro_upgrades(self):
'''
Implement the {backend}-get-distro-upgrades functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def repo_enable(self,repoid,enable):
+ def repo_enable(self, repoid, enable):
'''
Implement the {backend}-repo-enable functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def repo_set_data(self,repoid,parameter,value):
+ def repo_set_data(self, repoid, parameter, value):
'''
Implement the {backend}-repo-set-data functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def get_repo_list(self,filters):
+ def get_repo_list(self, filters):
'''
Implement the {backend}-get-repo-list functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def repo_signature_install(self,package):
+ def repo_signature_install(self, package):
'''
Implement the {backend}-repo-signature-install functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def download_packages(self,directory,packages):
+ def download_packages(self, directory, packages):
'''
Implement the {backend}-download-packages functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def set_locale(self,code):
+ def set_locale(self, code):
'''
Implement the {backend}-set-locale functionality
Needed to be implemented in a sub class
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
- def customTracebackHandler(self,tb):
+ def customTracebackHandler(self, tb):
'''
Custom Traceback Handler
this is called by the ExceptionHandler
@@ -435,149 +441,149 @@ class PackageKitBaseBackend:
fname = os.path.split(self.cmds[0])[1]
cmd = fname.split('.')[0] # get the helper filename wo ext
args = self.cmds[1:]
- self.dispatch_command(cmd,args)
+ self.dispatch_command(cmd, args)
- def dispatch_command(self,cmd,args):
+ def dispatch_command(self, cmd, args):
if cmd == 'download-packages':
- dir = args[0]
+ directory = args[0]
pkgs = args[1:]
- self.download_packages(dir,pkgs)
- self.finished();
+ self.download_packages(directory, pkgs)
+ self.finished()
elif cmd == 'get-depends':
filters = args[0]
pkgs = args[1].split('|')
recursive = args[2]
- self.get_depends(filters,pkgs,recursive)
- self.finished();
+ self.get_depends(filters, pkgs, recursive)
+ self.finished()
elif cmd == 'get-details':
pkgs = args[0].split('|')
self.get_details(pkgs)
- self.finished();
+ self.finished()
elif cmd == 'get-files':
pkgs = args[0].split('|')
self.get_files(pkgs)
- self.finished();
+ self.finished()
elif cmd == 'get-packages':
filters = args[0]
self.get_packages(filters)
- self.finished();
+ self.finished()
elif cmd == 'get-repo-list':
filters = args[0]
self.get_repo_list(filters)
- self.finished();
+ self.finished()
elif cmd == 'get-requires':
filters = args[0]
pkgs = args[1].split('|')
recursive = args[2]
- self.get_requires(filters,pkgs,recursive)
- self.finished();
+ self.get_requires(filters, pkgs, recursive)
+ self.finished()
elif cmd == 'get-update-detail':
pkgs = args[0].split('|')
self.get_update_detail(pkgs)
- self.finished();
+ self.finished()
elif cmd == 'get-distro-upgrades':
self.get_distro_upgrades()
- self.finished();
+ self.finished()
elif cmd == 'get-updates':
filters = args[0]
self.get_updates(filters)
- self.finished();
+ self.finished()
elif cmd == 'install-files':
trusted = args[0]
files_to_inst = args[1:]
- self.install_files(trusted,files_to_inst)
- self.finished();
+ self.install_files(trusted, files_to_inst)
+ self.finished()
elif cmd == 'install-packages':
pkgs = args[0:]
self.install_packages(pkgs)
- self.finished();
+ self.finished()
elif cmd == 'install-signature':
sigtype = args[0]
key_id = args[1]
package_id = args[2]
- self.install_signature(sigtype,key_id,package_id)
- self.finished();
+ self.install_signature(sigtype, key_id, package_id)
+ self.finished()
elif cmd == 'refresh-cache':
self.refresh_cache()
- self.finished();
+ self.finished()
elif cmd == 'remove-packages':
allowdeps = args[0]
packages = args[1:]
- self.remove_packages(allowdeps,packages)
- self.finished();
+ self.remove_packages(allowdeps, packages)
+ self.finished()
elif cmd == 'repo-enable':
repoid = args[0]
- state=args[1]
- self.repo_enable(repoid,state)
- self.finished();
+ state = args[1]
+ self.repo_enable(repoid, state)
+ self.finished()
elif cmd == 'repo-set-data':
repoid = args[0]
para = args[1]
- value=args[2]
- self.repo_set_data(repoid,para,value)
- self.finished();
+ value = args[2]
+ self.repo_set_data(repoid, para, value)
+ self.finished()
elif cmd == 'resolve':
filters = args[0]
packages = args[1:]
- self.resolve(filters,packages)
- self.finished();
+ self.resolve(filters, packages)
+ self.finished()
elif cmd == 'search-details':
options = args[0]
searchterms = args[1]
- self.search_details(options,searchterms)
- self.finished();
+ self.search_details(options, searchterms)
+ self.finished()
elif cmd == 'search-file':
options = args[0]
searchterms = args[1]
- self.search_file(options,searchterms)
- self.finished();
+ self.search_file(options, searchterms)
+ self.finished()
elif cmd == 'search-group':
options = args[0]
searchterms = args[1]
- self.search_group(options,searchterms)
- self.finished();
+ self.search_group(options, searchterms)
+ self.finished()
elif cmd == 'search-name':
options = args[0]
searchterms = args[1]
- self.search_name(options,searchterms)
- self.finished();
+ self.search_name(options, searchterms)
+ self.finished()
elif cmd == 'signature-install':
package = args[0]
self.repo_signature_install(package)
- self.finished();
+ self.finished()
elif cmd == 'update-packages':
packages = args[0:]
self.update_packages(packages)
- self.finished();
+ self.finished()
elif cmd == 'update-system':
self.update_system()
- self.finished();
+ self.finished()
elif cmd == 'what-provides':
filters = args[0]
provides_type = args[1]
search = args[2]
- self.what_provides(filters,provides_type,search)
- self.finished();
+ self.what_provides(filters, provides_type, search)
+ self.finished()
elif cmd == 'set-locale':
code = args[0]
self.set_locale(code)
- self.finished();
+ self.finished()
else:
errmsg = "command '%s' is not known" % cmd
- self.error(ERROR_INTERNAL_ERROR,errmsg,exit=False)
- self.finished();
+ self.error(ERROR_INTERNAL_ERROR, errmsg, exit=False)
+ self.finished()
- def dispatcher(self,args):
+ def dispatcher(self, args):
if len(args) > 0:
- self.dispatch_command(args[0],args[1:])
+ self.dispatch_command(args[0], args[1:])
while True:
line = raw_input('')
if line == 'exit':
break
args = line.split('\t')
- self.dispatch_command(args[0],args[1:])
+ self.dispatch_command(args[0], args[1:])
-def exceptionHandler(typ,value,tb,base):
+def exceptionHandler(typ, value, tb, base):
# Restore original exception handler
sys.excepthook = sys.__excepthook__
# Call backend custom Traceback handler
@@ -586,12 +592,12 @@ def exceptionHandler(typ,value,tb,base):
errmsg = 'Error Type: %s;' % str(typ)
errmsg += 'Error Value: %s;' % str(value)
for tub in etb:
- f,l,m,c = tub # file,lineno,function,codeline
- errmsg += ' File : %s, line %s, in %s;' % (f,str(l),m)
+ f, l, m, c = tub # file, lineno, function, codeline
+ errmsg += ' File : %s, line %s, in %s;' % (f, str(l), m)
errmsg += ' %s;' % c
# send the traceback to PackageKit
- base.error(ERROR_INTERNAL_ERROR,errmsg,exit=True)
+ base.error(ERROR_INTERNAL_ERROR, errmsg, exit=True)
def installExceptionHandler(base):
- sys.excepthook = lambda typ,value,tb: exceptionHandler(typ,value,tb,base)
+ sys.excepthook = lambda typ, value, tb: exceptionHandler(typ, value, tb, base)
diff --git a/python/packagekit/client.py b/python/packagekit/client.py
index 6101788..9866bc6 100644
--- a/python/packagekit/client.py
+++ b/python/packagekit/client.py
@@ -80,7 +80,6 @@ class PackageKitClient:
if self._error_enum:
raise PackageKitError(self._error_enum)
-
def _wrapBasicCall(self, pk_xn, method):
return self._wrapCall(pk_xn, method, {})
@@ -105,12 +104,11 @@ class PackageKitClient:
'''
result = []
- distup_cb = lambda typ,name,summary: result.append(
- PackageKitDistroUpgrade(typ,name,summary))
+ distup_cb = lambda typ, name, summary: result.append(
+ PackageKitDistroUpgrade(typ, name, summary))
self._wrapCall(pk_xn, method, {'DistroUpgrade' : distup_cb})
return result
-
def _wrapDetailsCall(self, pk_xn, method):
'''
Wraps a call which emits Finished, ErrorCode on completion and
@@ -164,7 +162,6 @@ class PackageKitClient:
self._wrapCall(pk_xn, method, {'Files' : files_cb})
return result
-
def SuggestDaemonQuit(self):
'''Ask the PackageKit daemon to shutdown.'''
@@ -174,9 +171,9 @@ class PackageKitClient:
# not initialized, or daemon timed out
pass
- def Resolve(self, filter, package):
+ def Resolve(self, filters, package):
'''
- Resolve a package name to a PackageKit package_id filter and
+ Resolve a package name to a PackageKit package_id filters and
package are directly passed to the PackageKit transaction
D-BUS method Resolve()
@@ -186,8 +183,7 @@ class PackageKitClient:
'''
package = self._to_list(package) # Make sure we have a list
xn = self._get_xn()
- return self._wrapPackageCall(xn, lambda : xn.Resolve(filter, package))
-
+ return self._wrapPackageCall(xn, lambda : xn.Resolve(filters, package))
def GetDetails(self, package_ids):
'''
@@ -200,35 +196,35 @@ class PackageKitClient:
xn = self._get_xn()
return self._wrapDetailsCall(xn, lambda : xn.GetDetails(package_ids))
- def SearchName(self, filter, name):
+ def SearchName(self, filters, name):
'''
Search a package by name.
'''
xn = self._get_xn()
- return self._wrapPackageCall(xn, lambda : xn.SearchName(filter, name))
+ return self._wrapPackageCall(xn, lambda : xn.SearchName(filters, name))
- def SearchGroup(self, filter, group_id):
+ def SearchGroup(self, filters, group_id):
'''
Search for a group.
'''
xn = self._get_xn()
- return self._wrapPackageCall(xn, lambda : xn.SearchGroup(filter, group_id))
+ return self._wrapPackageCall(xn, lambda : xn.SearchGroup(filters, group_id))
- def SearchDetails(self, filter, name):
+ def SearchDetails(self, filters, name):
'''
Search a packages details.
'''
xn = self._get_xn()
return self._wrapPackageCall(xn,
- lambda : xn.SearchDetails(filter, name))
+ lambda : xn.SearchDetails(filters, name))
- def SearchFile(self, filter, search):
+ def SearchFile(self, filters, search):
'''
Search for a file.
'''
xn = self._get_xn()
return self._wrapPackageCall(xn,
- lambda : xn.SearchFile(filter, search))
+ lambda : xn.SearchFile(filters, search))
def InstallPackages(self, package_ids, progress_cb=None):
'''Install a list of package IDs.
@@ -285,8 +281,7 @@ class PackageKitClient:
xn = self._get_xn()
self._wrapBasicCall(xn, lambda : xn.RefreshCache(force))
-
- def GetRepoList(self, filter=FILTER_NONE):
+ def GetRepoList(self, filters=FILTER_NONE):
'''
Returns the list of repositories used in the system
@@ -294,8 +289,7 @@ class PackageKitClient:
'''
xn = self._get_xn()
- return self._wrapReposCall(xn, lambda : xn.GetRepoList(filter))
-
+ return self._wrapReposCall(xn, lambda : xn.GetRepoList(filters))
def RepoEnable(self, repo_id, enabled):
'''
@@ -309,7 +303,7 @@ class PackageKitClient:
xn = self._get_xn()
self._wrapBasicCall(xn, lambda : xn.RepoEnable(repo_id, enabled))
- def GetUpdates(self, filter=FILTER_NONE):
+ def GetUpdates(self, filters=FILTER_NONE):
'''
This method should return a list of packages that are installed and
are upgradable.
@@ -317,15 +311,15 @@ class PackageKitClient:
It should only return the newest update for each installed package.
'''
xn = self._get_xn()
- return self._wrapPackageCall(xn, lambda : xn.GetUpdates(filter))
+ return self._wrapPackageCall(xn, lambda : xn.GetUpdates(filters))
- def GetPackages(self, filter=FILTER_NONE):
+ def GetPackages(self, filters=FILTER_NONE):
'''
- This method should return a total list of packages, limmited by the
- filter used
+ This method should return a total list of packages, limited by the
+ filters used
'''
xn = self._get_xn()
- return self._wrapPackageCall(xn, lambda : xn.GetPackages(filter))
+ return self._wrapPackageCall(xn, lambda : xn.GetPackages(filters))
def UpdateSystem(self):
'''
@@ -337,36 +331,35 @@ class PackageKitClient:
xn = self._get_xn()
self._wrapPackageCall(xn, lambda : xn.UpdateSystem())
- def DownloadPackages(self,package_ids):
+ def DownloadPackages(self, package_ids):
package_ids = self._to_list(package_ids) # Make sure we have a list
xn = self._get_xn()
- return self._wrapFilesCall(xn,lambda : xn.DownloadPackages(package_ids))
+ return self._wrapFilesCall(xn, lambda : xn.DownloadPackages(package_ids))
- def GetDepends(self,filter,package_ids,recursive=False):
+ def GetDepends(self, filters, package_ids, recursive=False):
'''
Search for dependencies for packages
'''
package_ids = self._to_list(package_ids) # Make sure we have a list
xn = self._get_xn()
return self._wrapPackageCall(xn,
- lambda : xn.GetDepends(filter,package_ids,recursive))
+ lambda : xn.GetDepends(filters, package_ids, recursive))
- def GetFiles(self,package_ids):
+ def GetFiles(self, package_ids):
package_ids = self._to_list(package_ids) # Make sure we have a list
xn = self._get_xn()
- return self._wrapFilesCall(xn,lambda : xn.GetFiles(package_ids))
+ return self._wrapFilesCall(xn, lambda : xn.GetFiles(package_ids))
-
- def GetRequires(self,filter,package_ids,recursive=False):
+ def GetRequires(self, filters, package_ids, recursive=False):
'''
Search for requirements for packages
'''
package_ids = self._to_list(package_ids) # Make sure we have a list
xn = self._get_xn()
return self._wrapPackageCall(xn,
- lambda : xn.GetRequires(filter,package_ids,recursive))
+ lambda : xn.GetRequires(filters, package_ids, recursive))
- def GetUpdateDetail(self,package_ids):
+ def GetUpdateDetail(self, package_ids):
'''
Get details for updates
'''
@@ -378,45 +371,43 @@ class PackageKitClient:
xn = self._get_xn()
return self._wrapPackageCall(xn, lambda : xn.GetDistroUpgrades())
- def InstallFiles(self,trusted,files):
+ def InstallFiles(self, trusted, files):
raise PackageKitError(ERROR_NOT_SUPPORTED)
- def InstallSignatures(self,sig_type,key_id,package_id):
+ def InstallSignatures(self, sig_type, key_id, package_id):
'''
Install packages signing keys used to validate packages
'''
xn = self._get_xn()
- self._wrapBasicCall(xn, lambda : xn.InstallSignatures(sig_type,key_id,package_id))
+ self._wrapBasicCall(xn, lambda : xn.InstallSignatures(sig_type, key_id, package_id))
- def RepoSetData(self,repo_id,parameter,value):
+ def RepoSetData(self, repo_id, parameter, value):
'''
Change custom parameter in Repository Configuration
'''
xn = self._get_xn()
- self._wrapBasicCall(xn, lambda : xn.RepoSetData(repo_id,parameter,value))
+ self._wrapBasicCall(xn, lambda : xn.RepoSetData(repo_id, parameter, value))
- def Rollback(self,transaction_id):
+ def Rollback(self, transaction_id):
xn = self._get_xn()
self._wrapBasicCall(xn, lambda : xn.Rollback(transaction_id))
- def WhatProvides(self,provide_type,search):
+ def WhatProvides(self, provide_type, search):
'''
Search for packages that provide the supplied attributes
'''
xn = self._get_xn()
return self._wrapPackageCall(xn,
- lambda : xn.WhatProvides(provide_type,search))
+ lambda : xn.WhatProvides(provide_type, search))
- def SetLocale(self,code):
+ def SetLocale(self, code):
xn = self._get_xn()
self._wrapBasicCall(xn, lambda : xn.SetLocale(code))
- def AcceptEula(self,eula_id):
+ def AcceptEula(self, eula_id):
xn = self._get_xn()
self._wrapBasicCall(xn, lambda : xn.AcceptEula(eula_id))
-
-
#
# Internal helper functions
#
@@ -480,13 +471,13 @@ class PackageKitClient:
'org.freedesktop.PolicyKit.AuthenticationAgent', '/',
'org.freedesktop.PolicyKit.AuthenticationAgent')
if(policykit == None):
- print("Error: Could not get PolicyKit D-Bus Interface\n")
+ print("Error: Could not get PolicyKit D-Bus Interface\n")
granted = policykit.ObtainAuthorization("org.freedesktop.packagekit.update-system",
(dbus.UInt32)(xid),
(dbus.UInt32)(os.getpid()))
def _doPackages(self, pk_xn, method, progress_cb):
- '''Shared implementation of InstallPackages,UpdatePackages and RemovePackages.'''
+ '''Shared implementation of InstallPackages, UpdatePackages and RemovePackages.'''
self._status = None
self._allow_cancel = False
@@ -526,7 +517,6 @@ class PackageKitClient:
class PermissionDeniedByPolicy(dbus.DBusException):
_dbus_error_name = 'org.freedesktop.PackageKit.Transaction.RefusedByPolicy'
-
def polkit_auth_wrapper(fn, *args, **kwargs):
'''Function call wrapper for PolicyKit authentication.
@@ -554,7 +544,5 @@ def polkit_auth_wrapper(fn, *args, **kwargs):
else:
raise
-
-
if __name__ == '__main__':
pass
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 22c1203..1fca9c8 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Copyright (C) 2007 Tim Lauridsen <timlau at fedoraproject.org>
-# Robin Norwood <rnorwood at redhat.com>
+# Robin Norwood <rnorwood at redhat.com>
#
# This file contain the base classes to implement a PackageKit python backend
@@ -25,12 +25,10 @@
import logging
import logging.handlers
import os
-import signal
import sys
import threading
import time
import traceback
-import types
import gobject
import dbus.service
@@ -44,7 +42,7 @@ logging.basicConfig(format="%(levelname)s:%(message)s")
pklog = logging.getLogger("PackageKitBackend")
pklog.setLevel(logging.WARN)
-syslog = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON,address='/dev/log')
+syslog = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON, address='/dev/log')
formatter = logging.Formatter('PackageKit: %(levelname)s: %(message)s')
syslog.setFormatter(formatter)
pklog.addHandler(syslog)
@@ -63,16 +61,16 @@ def forked(func):
Decorator to fork a worker process.
Use a custom doCancel method in your backend to cancel forks:
-
+
def doCancel(self):
if self._child_pid:
- os.kill(self._child_pid,signal.SIGQUIT)
+ os.kill(self._child_pid, signal.SIGQUIT)
self._child_pid = None
self.Finished(EXIT_SUCCESS)
return
self.Finished(EXIT_FAILED)
'''
- def wrapper(*args,**kwargs):
+ def wrapper(*args, **kwargs):
self = args[0]
self.AllowCancel(True)
# Make sure that we are not in the worker process
@@ -82,7 +80,7 @@ def forked(func):
# Make sure that there is no another child process running
retries = 0
while self._is_child_running() and retries < 5:
- pklog.warning("Method called,but a child is already running")
+ pklog.warning("Method called, but a child is already running")
time.sleep(0.1)
retries += 1
if self._is_child_running():
@@ -95,10 +93,10 @@ def forked(func):
self.last_action_time = time.time()
self._child_pid = os.fork()
if self._child_pid > 0:
- gobject.child_watch_add(self._child_pid,self.on_child_exit)
+ gobject.child_watch_add(self._child_pid, self.on_child_exit)
return
self.loop.quit()
- sys.exit(func(*args,**kwargs))
+ sys.exit(func(*args, **kwargs))
return wrapper
class PackageKitThread(threading.Thread):
@@ -109,19 +107,19 @@ class PackageKitThread(threading.Thread):
def run(self):
try:
threading.Thread.run(self)
- except (KeyboardInterrupt,SystemExit):
- raise
+ except (KeyboardInterrupt, SystemExit):
+ raise
except:
- sys.excepthook(*sys.exc_info())
+ sys.excepthook(*sys.exc_info())
def threaded(func):
'''
Decorator to run a PackageKitBaseBackend method in a separate thread
'''
- def wrapper(*args,**kwargs):
+ def wrapper(*args, **kwargs):
backend = args[0]
backend.last_action_time = time.time()
- thread = PackageKitThread(target=func,args=args,kwargs=kwargs)
+ thread = PackageKitThread(target=func, args=args, kwargs=kwargs)
thread.start()
wrapper.__name__ = func.__name__
return wrapper
@@ -130,10 +128,10 @@ def async(func):
'''
Decorator which makes sure no other threads are running before executing function.
'''
- def wrapper(*args,**kwargs):
+ def wrapper(*args, **kwargs):
backend = args[0]
backend._lock.acquire()
- func(*args,**kwargs)
+ func(*args, **kwargs)
backend._lock.release()
wrapper.__name__ = func.__name__
return wrapper
@@ -141,11 +139,11 @@ def async(func):
class PackageKitBaseBackend(dbus.service.Object):
def PKSignalHouseKeeper(func):
- def wrapper(*args,**kwargs):
+ def wrapper(*args, **kwargs):
self = args[0]
self.last_action_time = time.time()
- return func(*args,**kwargs)
+ return func(*args, **kwargs)
return wrapper
@@ -155,16 +153,16 @@ class PackageKitBaseBackend(dbus.service.Object):
# has to call self.last_action_time = time.time()
#
# def PKMethodHouseKeeper(func):
-# def wrapper(*args,**kwargs):
+# def wrapper(*args, **kwargs):
# self = args[0]
# self.last_action_time = time.time()
#
-# return func(*args,**kwargs)
+# return func(*args, **kwargs)
#
# return wrapper
- def __init__(self,bus_name,dbus_path):
- dbus.service.Object.__init__(self,bus_name,dbus_path)
+ def __init__(self, bus_name, dbus_path):
+ dbus.service.Object.__init__(self, bus_name, dbus_path)
sys.excepthook = self._excepthook
self._allow_cancel = False
@@ -173,7 +171,7 @@ class PackageKitBaseBackend(dbus.service.Object):
self.loop = gobject.MainLoop()
- gobject.timeout_add(INACTIVE_CHECK_INTERVAL,self.check_for_inactivity)
+ gobject.timeout_add(INACTIVE_CHECK_INTERVAL, self.check_for_inactivity)
self.last_action_time = time.time()
self.loop.run()
@@ -184,19 +182,19 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Exit()
return True
- def on_child_exit(pid,condition,data):
+ def on_child_exit(self, pid, condition, data):
pass
def _is_child_running(self):
pklog.debug("in child_is_running")
if self._child_pid:
- pklog.debug("in child_is_running,pid = %s" % self._child_pid)
+ pklog.debug("in child_is_running, pid = %s" % self._child_pid)
running = True
try:
- (pid,status) = os.waitpid(self._child_pid,os.WNOHANG)
+ (pid, status) = os.waitpid(self._child_pid, os.WNOHANG)
if pid:
running = False
- except OSError,e:
+ except OSError, e:
pklog.error("OS Error: %s" % str(e))
running = False
@@ -218,44 +216,44 @@ class PackageKitBaseBackend(dbus.service.Object):
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='s')
- def Finished(self,exit):
+ def Finished(self, exit):
pklog.info("Finished (%s)" % (exit))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ssb')
- def RepoDetail(self,repo_id,description,enabled):
- pklog.info("RepoDetail (%s,%s,%i)" % (repo_id,description,enabled))
+ def RepoDetail(self, repo_id, description, enabled):
+ pklog.info("RepoDetail (%s, %s, %i)" % (repo_id, description, enabled))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='b')
- def AllowCancel(self,allow_cancel):
+ def AllowCancel(self, allow_cancel):
self._allow_cancel = allow_cancel
pklog.info("AllowCancel (%i)" % allow_cancel)
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='sss')
- def Package(self,status,package_id,summary):
- pklog.info("Package (%s,%s,%s)" % (status,package_id,summary))
+ def Package(self, status, package_id, summary):
+ pklog.info("Package (%s, %s, %s)" % (status, package_id, summary))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ssssst')
- def Details(self,package_id,license,group,detail,url,size):
- pklog.info("Details (%s,%s,%s,%s,%s,%u)" % (package_id,license,group,detail,url,size))
+ def Details(self, package_id, license, group, detail, url, size):
+ pklog.info("Details (%s, %s, %s, %s, %s, %u)" % (package_id, license, group, detail, url, size))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ss')
- def Files(self,package_id,file_list):
- pklog.info("Files (%s,%s)" % (package_id,file_list))
+ def Files(self, package_id, file_list):
+ pklog.info("Files (%s, %s)" % (package_id, file_list))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='s')
- def StatusChanged(self,status):
+ def StatusChanged(self, status):
pklog.info("StatusChanged (%s)" % (status))
@PKSignalHouseKeeper
@@ -266,53 +264,53 @@ class PackageKitBaseBackend(dbus.service.Object):
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='u')
- def PercentageChanged(self,percentage):
+ def PercentageChanged(self, percentage):
pklog.info("PercentageChanged (%i)" % (percentage))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='u')
- def SubPercentageChanged(self,percentage):
+ def SubPercentageChanged(self, percentage):
pklog.info("SubPercentageChanged (%i)" % (percentage))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ssssssssssss')
- def UpdateDetail(self,package_id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update,changelog,state,issued,updated):
- pklog.info("UpdateDetail (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % (package_id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update,changelog,state,issued,updated))
+ def UpdateDetail(self, package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update, changelog, state, issued, updated):
+ pklog.info("UpdateDetail (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" % (package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update, changelog, state, issued, updated))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ss')
- def ErrorCode(self,code,description):
+ def ErrorCode(self, code, description):
'''
send 'error'
- @param err: Error Type (ERROR_NO_NETWORK,ERROR_NOT_SUPPORTED,ERROR_INTERNAL_ERROR)
+ @param err: Error Type (ERROR_NO_NETWORK, ERROR_NOT_SUPPORTED, ERROR_INTERNAL_ERROR)
@param description: Error description
'''
- pklog.info("ErrorCode (%s,%s)" % (code,description))
+ pklog.info("ErrorCode (%s, %s)" % (code, description))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ss')
- def RequireRestart(self,type,details):
+ def RequireRestart(self, type, details):
'''
send 'require-restart' signal:
- @param type: The level of restart required (system,application,session)
+ @param type: The level of restart required (system, application, session)
@param details: Optional details about the restart
'''
- pklog.info("RestartRequired (%s,%s)" % (type,details))
+ pklog.info("RestartRequired (%s, %s)" % (type, details))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ss')
- def Message(self,type,details):
+ def Message(self, type, details):
'''
send 'message' signal:
- @param type: The type of message (warning,notice,daemon)
+ @param type: The type of message (warning, notice, daemon)
@param details: Required details about the message
'''
- pklog.info("Message (%s,%s)" % (type,details))
+ pklog.info("Message (%s, %s)" % (type, details))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
@@ -325,14 +323,14 @@ class PackageKitBaseBackend(dbus.service.Object):
@param vendor_name: the freedom hater
@param license_agreement: the plain text license agreement
'''
- pklog.info("Eula required (%s,%s,%s,%s)" % (eula_id, package_id,
+ pklog.info("Eula required (%s, %s, %s, %s)" % (eula_id, package_id,
vendor_name,
license_agreement))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='')
- def UpdatesChanged(self,typ,fname):
+ def UpdatesChanged(self, typ, fname):
'''
send 'updates-changed' signal:
'''
@@ -341,12 +339,12 @@ class PackageKitBaseBackend(dbus.service.Object):
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ssssssss')
- def RepoSignatureRequired(self,id,repo_name,key_url,key_userid,key_id,key_fingerprint,key_timestamp,key_type):
+ def RepoSignatureRequired(self, id, repo_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, key_type):
'''
send 'repo-signature-required' signal:
'''
- pklog.info("RepoSignatureRequired (%s,%s,%s,%s,%s,%s,%s,%s)" %
- (id,repo_name,key_url,key_userid,key_id,key_fingerprint,key_timestamp,key_type))
+ pklog.info("RepoSignatureRequired (%s, %s, %s, %s, %s, %s, %s, %s)" %
+ (id, repo_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, key_type))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
@@ -358,9 +356,7 @@ class PackageKitBaseBackend(dbus.service.Object):
@param name: Short name of the distribution e.g. Dapper Drake 6.06 LTS
@param summary: Multi-line description of the release
'''
- pklog.info("DistroUpgrade (%s,%s,%s)" % (type, name, summary))
-
-
+ pklog.info("DistroUpgrade (%s, %s, %s)" % (type, name, summary))
#
# Methods ( client -> engine -> backend )
@@ -368,10 +364,10 @@ class PackageKitBaseBackend(dbus.service.Object):
# Python inheritence with decorators makes implementing these in the
# base class and overriding them in child classes very ugly. So
# they're commented out here. Just implement the ones you need in
-# your class,and don't forget the decorators.
+# your class, and don't forget the decorators.
#
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='',out_signature='')
+ in_signature='', out_signature='')
def Init(self):
pklog.info("Init()")
self.doInit()
@@ -391,7 +387,7 @@ class PackageKitBaseBackend(dbus.service.Object):
sys.exit(1)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='',out_signature='')
+ in_signature='', out_signature='')
def Exit(self):
pklog.info("Exit()")
gobject.idle_add (self._doExitDelay)
@@ -406,15 +402,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='ss',out_signature='')
- def SearchName(self,filters,search):
+ in_signature='ss', out_signature='')
+ def SearchName(self, filters, search):
'''
Implement the {backend}-search-name functionality
'''
pklog.info("SearchName()")
- self.doSearchName(filters,search)
+ self.doSearchName(filters, search)
- def doSearchName(self,filters,search):
+ def doSearchName(self, filters, search):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -423,15 +419,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='s',out_signature='')
- def GetPackages(self,filters):
+ in_signature='s', out_signature='')
+ def GetPackages(self, filters):
'''
Implement the {backend}-get-packages functionality
'''
pklog.info("GetPackages()")
self.doGetPackages(filters)
- def doGetPackages(self,filters):
+ def doGetPackages(self, filters):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -440,11 +436,11 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='',out_signature='')
+ in_signature='', out_signature='')
def Cancel(self):
pklog.info("Cancel()")
if not self._allow_cancel:
- self.ErrorCode(ERROR_CANNOT_CANCEL,"Current action cannot be cancelled")
+ self.ErrorCode(ERROR_CANNOT_CANCEL, "Current action cannot be cancelled")
self.Finished(EXIT_FAILED)
return
self.doCancel()
@@ -458,15 +454,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='ss',out_signature='')
- def DownloadPackages(self,package_ids,directory):
+ in_signature='ss', out_signature='')
+ def DownloadPackages(self, package_ids, directory):
'''
Implement the (backend)-download-packages functionality
'''
- pklog.info("DownloadPackages(%s,%s)" % (package_ids, directory))
+ pklog.info("DownloadPackages(%s, %s)" % (package_ids, directory))
self.doDownloadPackages(package_ids, directory)
- def doDownloadPackages(self,package_ids,directory):
+ def doDownloadPackages(self, package_ids, directory):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -475,15 +471,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='ss',out_signature='')
- def SearchDetails(self,filters,key):
+ in_signature='ss', out_signature='')
+ def SearchDetails(self, filters, key):
'''
Implement the {backend}-search-details functionality
'''
- pklog.info("SearchDetails(%s,%s)" % (filters,key))
- self.doSearchDetails(filters,key)
+ pklog.info("SearchDetails(%s, %s)" % (filters, key))
+ self.doSearchDetails(filters, key)
- def doSearchDetails(self,filters,key):
+ def doSearchDetails(self, filters, key):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -492,15 +488,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='ss',out_signature='')
- def SearchGroup(self,filters,key):
+ in_signature='ss', out_signature='')
+ def SearchGroup(self, filters, key):
'''
Implement the {backend}-search-group functionality
'''
- pklog.info("SearchGroup(%s,%s)" % (filters,key))
- self.doSearchGroup(filters,key)
+ pklog.info("SearchGroup(%s, %s)" % (filters, key))
+ self.doSearchGroup(filters, key)
- def doSearchGroup(self,filters,key):
+ def doSearchGroup(self, filters, key):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -509,15 +505,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='ss',out_signature='')
- def SearchFile(self,filters,key):
+ in_signature='ss', out_signature='')
+ def SearchFile(self, filters, key):
'''
Implement the {backend}-search-file functionality
'''
- pklog.info("SearchFile(%s,%s)" % (filters,key))
- self.doSearchFile(filters,key)
+ pklog.info("SearchFile(%s, %s)" % (filters, key))
+ self.doSearchFile(filters, key)
- def doSearchFile(self,filters,key):
+ def doSearchFile(self, filters, key):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -531,8 +527,8 @@ class PackageKitBaseBackend(dbus.service.Object):
'''
Print a list of requires for a given package
'''
- pklog.info("GetRequires(%s,%s,%s)" % (filters, package_ids, recursive))
- self.doGetRequires(filters, package_ids ,recursive)
+ pklog.info("GetRequires(%s, %s, %s)" % (filters, package_ids, recursive))
+ self.doGetRequires(filters, package_ids , recursive)
def doGetRequires(self, filters, package_ids, recursive):
'''
@@ -543,15 +539,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='sss',out_signature='')
- def WhatProvides(self,filters,provides_type,search):
+ in_signature='sss', out_signature='')
+ def WhatProvides(self, filters, provides_type, search):
'''
Print a list of packages for a given provide string
'''
- pklog.info("WhatProvides(%s,%s,%s)" % (filters,provides_type,search))
- self.doWhatProvides(filters,provides_type,search)
+ pklog.info("WhatProvides(%s, %s, %s)" % (filters, provides_type, search))
+ self.doWhatProvides(filters, provides_type, search)
- def doWhatProvides(self,filters,provides_type,search):
+ def doWhatProvides(self, filters, provides_type, search):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -560,15 +556,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='ssb',out_signature='')
- def GetDepends(self,filters,package_ids,recursive):
+ in_signature='ssb', out_signature='')
+ def GetDepends(self, filters, package_ids, recursive):
'''
Print a list of depends for a given package
'''
- pklog.info("GetDepends(%s,%s,%s)" % (filters,package_ids,recursive))
- self.doGetDepends(filters,package_ids,recursive)
+ pklog.info("GetDepends(%s, %s, %s)" % (filters, package_ids, recursive))
+ self.doGetDepends(filters, package_ids, recursive)
- def doGetDepends(self,filters,package_ids,recursive):
+ def doGetDepends(self, filters, package_ids, recursive):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -577,7 +573,7 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='',out_signature='')
+ in_signature='', out_signature='')
def UpdateSystem(self):
'''
Implement the {backend}-update-system functionality
@@ -594,8 +590,8 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='b',out_signature='')
- def RefreshCache(self,force):
+ in_signature='b', out_signature='')
+ def RefreshCache(self, force):
'''
Implement the {backend}-refresh_cache functionality
'''
@@ -611,15 +607,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='ss',out_signature='')
- def Resolve(self,filters,name):
+ in_signature='ss', out_signature='')
+ def Resolve(self, filters, name):
'''
Implement the {backend}-resolve functionality
'''
- pklog.info("Resolve(%s,%s)" % (filters,name))
- self.doResolve(filters,name)
+ pklog.info("Resolve(%s, %s)" % (filters, name))
+ self.doResolve(filters, name)
- def doResolve(self,filters,name):
+ def doResolve(self, filters, name):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -628,15 +624,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='as',out_signature='')
- def InstallPackages(self,package_ids):
+ in_signature='as', out_signature='')
+ def InstallPackages(self, package_ids):
'''
Implement the {backend}-install functionality
'''
pklog.info("InstallPackages(%s)" % package_ids)
self.doInstallPackages(package_ids)
- def doInstallPackages(self,package_ids):
+ def doInstallPackages(self, package_ids):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -645,16 +641,16 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='bas',out_signature='')
- def InstallFiles (self,trusted,full_paths):
+ in_signature='bas', out_signature='')
+ def InstallFiles (self, trusted, full_paths):
'''
Implement the {backend}-install_files functionality
Install the package containing the full_paths file
'''
- pklog.info("InstallFiles(%i,%s)" % (trusted,full_paths))
- self.doInstallFiles(trusted,full_paths)
+ pklog.info("InstallFiles(%i, %s)" % (trusted, full_paths))
+ self.doInstallFiles(trusted, full_paths)
- def doInstallFiles(self,full_paths):
+ def doInstallFiles(self, full_paths):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -663,15 +659,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='sb',out_signature='')
- def ServicePack (self,location,enabled):
+ in_signature='sb', out_signature='')
+ def ServicePack (self, location, enabled):
'''
Implement the {backend}-service-pack functionality
'''
- pklog.info("ServicePack(%s,%s)" % (location,enabled))
- self.doServicePack(location,enabled)
+ pklog.info("ServicePack(%s, %s)" % (location, enabled))
+ self.doServicePack(location, enabled)
- def doServicePack(self,location,enabled):
+ def doServicePack(self, location, enabled):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -680,15 +676,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='as',out_signature='')
- def UpdatePackages(self,package_ids):
+ in_signature='as', out_signature='')
+ def UpdatePackages(self, package_ids):
'''
Implement the {backend}-update-packages functionality
'''
pklog.info("UpdatePackages(%s)" % package_ids)
self.doUpdatePackages(package_ids)
- def doUpdatePackages(self,package_ids):
+ def doUpdatePackages(self, package_ids):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -697,16 +693,16 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='asbb',out_signature='')
- def RemovePackages(self,package_ids,allowdep,autoremove):
+ in_signature='asbb', out_signature='')
+ def RemovePackages(self, package_ids, allowdep, autoremove):
'''
Implement the {backend}-remove functionality
'''
- pklog.info("RemovePackages(%s,%s,%s)" % (package_ids,allowdep,
+ pklog.info("RemovePackages(%s, %s, %s)" % (package_ids, allowdep,
autoremove))
- self.doRemovePackages(package_ids,allowdep,autoremove)
+ self.doRemovePackages(package_ids, allowdep, autoremove)
- def doRemovePackages(self,package_ids,allowdep,autoremove):
+ def doRemovePackages(self, package_ids, allowdep, autoremove):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -715,15 +711,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='s',out_signature='')
- def GetDetails(self,package_ids):
+ in_signature='s', out_signature='')
+ def GetDetails(self, package_ids):
'''
Print a detailed details for a given package
'''
pklog.info("GetDetails(%s)" % package_ids)
self.doGetDetails(package_ids)
- def doGetDetails(self,package_ids):
+ def doGetDetails(self, package_ids):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -732,15 +728,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='s',out_signature='')
- def GetFiles(self,package_ids):
+ in_signature='s', out_signature='')
+ def GetFiles(self, package_ids):
'''
Implement the get-files method
'''
pklog.info("GetFiles(%s)" % package_ids)
self.doGetFiles(package_ids)
- def doGetFiles(self,package_ids):
+ def doGetFiles(self, package_ids):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -749,7 +745,7 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='',out_signature='')
+ in_signature='', out_signature='')
def GetDistroUpgrades(self):
'''
Implement the {backend}-get-distro-upgrades functionality
@@ -766,15 +762,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='s',out_signature='')
- def GetUpdates(self,filters):
+ in_signature='s', out_signature='')
+ def GetUpdates(self, filters):
'''
Implement the {backend}-get-updates functionality
'''
pklog.info("GetUpdates(%s)" % filters)
self.doGetUpdates(filters)
- def doGetUpdates(self,filters):
+ def doGetUpdates(self, filters):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -783,15 +779,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='sb',out_signature='')
- def RepoEnable(self,repoid,enable):
+ in_signature='sb', out_signature='')
+ def RepoEnable(self, repoid, enable):
'''
Implement the {backend}-repo-enable functionality
'''
- pklog.info("RepoEnable(%s,%s)" % (repoid,enable))
- self.doRepoEnable( repoid,enable)
+ pklog.info("RepoEnable(%s, %s)" % (repoid, enable))
+ self.doRepoEnable( repoid, enable)
- def doRepoEnable(self,repoid,enable):
+ def doRepoEnable(self, repoid, enable):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -800,15 +796,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='',out_signature='')
- def GetRepoList(self,filters):
+ in_signature='', out_signature='')
+ def GetRepoList(self, filters):
'''
Implement the {backend}-get-repo-list functionality
'''
pklog.info("GetRepoList()")
self.doGetRepoList(filters)
- def doGetRepoList(self,filters):
+ def doGetRepoList(self, filters):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -817,15 +813,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='s',out_signature='')
- def GetUpdateDetail(self,package_ids):
+ in_signature='s', out_signature='')
+ def GetUpdateDetail(self, package_ids):
'''
Implement the {backend}-get-update_detail functionality
'''
pklog.info("GetUpdateDetail(%s)" % package_ids)
self.doGetUpdateDetail(package_ids)
- def doGetUpdateDetail(self,package_ids):
+ def doGetUpdateDetail(self, package_ids):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -834,15 +830,15 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='sss',out_signature='')
- def RepoSetData(self,repoid,parameter,value):
+ in_signature='sss', out_signature='')
+ def RepoSetData(self, repoid, parameter, value):
'''
Implement the {backend}-repo-set-data functionality
'''
- pklog.info("RepoSetData(%s,%s,%s)" % (repoid,parameter,value))
- self.doRepoSetData(repoid,parameter,value)
+ pklog.info("RepoSetData(%s, %s, %s)" % (repoid, parameter, value))
+ self.doRepoSetData(repoid, parameter, value)
- def doRepoSetData(self,repoid,parameter,value):
+ def doRepoSetData(self, repoid, parameter, value):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -851,30 +847,30 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='ss',out_signature='')
- def SetProxy(self,proxy_http,proxy_ftp):
+ in_signature='ss', out_signature='')
+ def SetProxy(self, proxy_http, proxy_ftp):
'''
Set the proxy
'''
- pklog.info("SetProxy(%s,%s)" % (proxy_http,proxy_ftp))
- self.doSetProxy(proxy_http,proxy_ftp)
+ pklog.info("SetProxy(%s, %s)" % (proxy_http, proxy_ftp))
+ self.doSetProxy(proxy_http, proxy_ftp)
- def doSetProxy(self,proxy_http,proxy_ftp):
+ def doSetProxy(self, proxy_http, proxy_ftp):
'''
Should be replaced in the corresponding backend sub class
'''
# do not use Finished() in this method
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='s',out_signature='')
- def InstallPublicKey(self,keyurl):
+ in_signature='s', out_signature='')
+ def InstallPublicKey(self, keyurl):
'''
Implement the {backend}-install-public-key functionality
'''
pklog.info("InstallPublicKey(%s)" % keyurl)
self.doInstallPublicKey(keyurl)
- def doInstallPublicKey(self,keyurl):
+ def doInstallPublicKey(self, keyurl):
'''
Should be replaced in the corresponding backend sub class
'''
@@ -883,7 +879,7 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
- in_signature='s',out_signature='')
+ in_signature='s', out_signature='')
def SetLocale(self, code):
'''
Allow to set the locale of the backend.
@@ -903,16 +899,16 @@ class PackageKitBaseBackend(dbus.service.Object):
# Utility methods
#
- def _get_package_id(self,name,version,arch,data):
- return "%s;%s;%s;%s" % (name,version,arch,data)
+ def _get_package_id(self, name, version, arch, data):
+ return "%s;%s;%s;%s" % (name, version, arch, data)
- def get_package_from_id(self,id):
+ def get_package_from_id(self, id):
''' split up a package id name;ver;arch;data into a tuple
- containing (name,ver,arch,data)
+ containing (name, ver, arch, data)
'''
- return tuple(id.split(';',4))
+ return tuple(id.split(';', 4))
- def check_license_field(self,license_field):
+ def check_license_field(self, license_field):
'''
Check the string license_field for free licenses, indicated by
their short names as documented at
@@ -946,8 +942,8 @@ class PackageKitBaseBackend(dbus.service.Object):
one_free_group = False
for group in groups:
- group = group.replace("(","")
- group = group.replace(")","")
+ group = group.replace("(", "")
+ group = group.replace(")", "")
licenses = group.split(" or ")
group_is_free = False
@@ -974,26 +970,26 @@ class PackageKitBaseBackend(dbus.service.Object):
return True
- def _customTracebackHandler(self,exctype):
+ def _customTracebackHandler(self, exctype):
'''
'''
return False
- def _excepthook(self,exctype,excvalue,exctb):
+ def _excepthook(self, exctype, excvalue, exctb):
'''
Handle a crash: try to submit the message to packagekitd and the logger.
afterwards shutdown the daemon.
'''
- if (issubclass(exctype,KeyboardInterrupt) or
- issubclass(exctype,SystemExit)):
+ if (issubclass(exctype, KeyboardInterrupt) or
+ issubclass(exctype, SystemExit)):
return
if self._customTracebackHandler(exctype):
return
- tbtext = ''.join(traceback.format_exception(exctype,excvalue,exctb))
+ tbtext = ''.join(traceback.format_exception(exctype, excvalue, exctb))
try:
- self.ErrorCode(ERROR_INTERNAL_ERROR,tbtext)
+ self.ErrorCode(ERROR_INTERNAL_ERROR, tbtext)
self.Finished(EXIT_FAILED)
except:
pass
@@ -1014,7 +1010,7 @@ class PackagekitProgress:
from packagekit.backend import PackagekitProgress
- steps = [10,30,50,70] # Milestones in %
+ steps = [10, 30, 50, 70] # Milestones in %
progress = PackagekitProgress()
progress.set_steps(steps)
for milestone in range(len(steps)):
@@ -1035,7 +1031,7 @@ class PackagekitProgress:
self.current_step = 0
self.subpercent = 0
- def set_steps(self,steps):
+ def set_steps(self, steps):
'''
Set the steps for the whole transaction
@param steps: list of int representing the percentage of each step in the transaction
@@ -1062,7 +1058,7 @@ class PackagekitProgress:
self.percent = 100
self.subpercent = 0
- def set_subpercent(self,pct):
+ def set_subpercent(self, pct):
'''
Set subpercentage and update percentage
'''
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index ea2b42e..ec83a94 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -29,406 +29,406 @@ from pkexceptions import PackageKitAccessDenied, PackageKitTransactionFailure
from pkexceptions import PackageKitBackendFailure
class PackageKit(PackageKitDbusInterface):
- def __init__(self):
- PackageKitDbusInterface.__init__(self,
- 'org.freedesktop.PackageKit',
- 'org.freedesktop.PackageKit',
- '/org/freedesktop/PackageKit')
-
- def tid(self):
- return self.pk_iface.GetTid()
-
- def job_id(func):
- def wrapper(*args,**kwargs):
- jid = func(*args,**kwargs)
- if jid == -1:
- raise PackageKitTransactionFailure
- else:
- return jid
- return wrapper
-
- def run(self):
- self.loop = gobject.MainLoop()
- self.loop.run()
-
- def catchall_signal_handler(self,*args, **kwargs):
- if kwargs['member'] == "Finished":
- self.loop.quit()
- self.Finished(args[0],args[1],args[2])
- elif kwargs['member'] == "ProgressChanged":
- self.ProgressChanged(args[0], float(args[1])+(float(args[2])/100.0),args[3],args[4])
- elif kwargs['member'] == "StatusChanged":
- self.JobStatus(args[0], args[1])
- elif kwargs['member'] == "Package":
- self.Package(args[0],args[1],args[2],args[3])
- elif kwargs['member'] == "UpdateDetail":
- self.UpdateDetail(args[0],args[1],args[2],args[3],args[4],args[5],args[6])
- elif kwargs['member'] == "Details":
- self.Details(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7])
- elif kwargs['member'] == "ErrorCode":
- self.ErrorCode(args[0],args[1],args[2])
- elif kwargs['member'] == "RequireRestart":
- self.RequireRestart(args[0],args[1],args[2])
- elif kwargs['member'] == "Transaction":
- self.Transaction(args[0],args[1],args[2],args[3],args[4],args[5])
- elif kwargs['member'] in ["TransactionListChanged",
- "AllowCancel","JobListChanged", "Locked"]:
- pass
- else:
- print "Caught unhandled signal %s"% kwargs['member']
- print " args:"
- for arg in args:
- print " " + str(arg)
+ def __init__(self):
+ PackageKitDbusInterface.__init__(self,
+ 'org.freedesktop.PackageKit',
+ 'org.freedesktop.PackageKit',
+ '/org/freedesktop/PackageKit')
+
+ def tid(self):
+ return self.pk_iface.GetTid()
+
+ def job_id(func):
+ def wrapper(*args, **kwargs):
+ jid = func(*args, **kwargs)
+ if jid == -1:
+ raise PackageKitTransactionFailure
+ else:
+ return jid
+ return wrapper
+
+ def run(self):
+ self.loop = gobject.MainLoop()
+ self.loop.run()
+
+ def catchall_signal_handler(self, *args, **kwargs):
+ if kwargs['member'] == "Finished":
+ self.loop.quit()
+ self.Finished(args[0], args[1], args[2])
+ elif kwargs['member'] == "ProgressChanged":
+ self.ProgressChanged(args[0], float(args[1])+(float(args[2])/100.0), args[3], args[4])
+ elif kwargs['member'] == "StatusChanged":
+ self.JobStatus(args[0], args[1])
+ elif kwargs['member'] == "Package":
+ self.Package(args[0], args[1], args[2], args[3])
+ elif kwargs['member'] == "UpdateDetail":
+ self.UpdateDetail(args[0], args[1], args[2], args[3], args[4], args[5], args[6])
+ elif kwargs['member'] == "Details":
+ self.Details(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7])
+ elif kwargs['member'] == "ErrorCode":
+ self.ErrorCode(args[0], args[1], args[2])
+ elif kwargs['member'] == "RequireRestart":
+ self.RequireRestart(args[0], args[1], args[2])
+ elif kwargs['member'] == "Transaction":
+ self.Transaction(args[0], args[1], args[2], args[3], args[4], args[5])
+ elif kwargs['member'] in ["TransactionListChanged",
+ "AllowCancel", "JobListChanged", "Locked"]:
+ pass
+ else:
+ print "Caught unhandled signal %s"% kwargs['member']
+ print " args:"
+ for arg in args:
+ print " " + str(arg)
# --- PK Signal Handlers ---
- def Finished(self,
- jid, # Job ID
- status, # enum - unknown, success, failed, canceled
- running_time # amount of time transaction has been running in seconds
- ):
- pass
-
- def ProgressChanged(self,
- jid, # Job ID
- percent, # 0.0 - 100.0
- elapsed, # time
- remaining # time
- ):
- pass
-
- def JobStatus(self,
- jid, # Job ID
- status # enum - invalid, setup, download, install, update, exit
- ):
- pass
-
- def Package(self,
- jid, # Job ID
- value, # installed=1, not-installed=0 | security=1, normal=0
- package_id,
- package_summary
- ):
- pass
-
- def UpdateDetail(self,
- jid, # Job ID
- package_id,
- updates,
- obsoletes,
- url,
- restart_required,
- update_text
- ):
- pass
-
- def Details(self,
- jid, # Job ID
- package_id,
- license,
- group,
- detail,
- url,
- size, # in bytes
- file_list # separated by ';'
- ):
- pass
-
- def ErrorCode(self,
- jid, # Job ID
- error_code, # enumerated - see pk-enum.c in PackageKit source
- details # non-localized details
- ):
- pass
-
- def RequireRestart(self,
- jid, # Job ID
- type, # enum - system,application,session
- details # non-localized details
- ):
- pass
-
- def Transaction(self,
- jid, # Job ID
- old_jid, # Old Job ID
- timespec, # Time (2007-09-27T15:29:22Z)
- succeeded, # 1 or 0
- role, # enum, see task_role in pk-enum.c
- duration # in seconds
- ):
- pass
+ def Finished(self,
+ jid, # Job ID
+ status, # enum - unknown, success, failed, canceled
+ running_time # amount of time transaction has been running in seconds
+ ):
+ pass
+
+ def ProgressChanged(self,
+ jid, # Job ID
+ percent, # 0.0 - 100.0
+ elapsed, # time
+ remaining # time
+ ):
+ pass
+
+ def JobStatus(self,
+ jid, # Job ID
+ status # enum - invalid, setup, download, install, update, exit
+ ):
+ pass
+
+ def Package(self,
+ jid, # Job ID
+ value, # installed=1, not-installed=0 | security=1, normal=0
+ package_id,
+ package_summary
+ ):
+ pass
+
+ def UpdateDetail(self,
+ jid, # Job ID
+ package_id,
+ updates,
+ obsoletes,
+ url,
+ restart_required,
+ update_text
+ ):
+ pass
+
+ def Details(self,
+ jid, # Job ID
+ package_id,
+ license,
+ group,
+ detail,
+ url,
+ size, # in bytes
+ file_list # separated by ';'
+ ):
+ pass
+
+ def ErrorCode(self,
+ jid, # Job ID
+ error_code, # enumerated - see pk-enum.c in PackageKit source
+ details # non-localized details
+ ):
+ pass
+
+ def RequireRestart(self,
+ jid, # Job ID
+ type, # enum - system, application, session
+ details # non-localized details
+ ):
+ pass
+
+ def Transaction(self,
+ jid, # Job ID
+ old_jid, # Old Job ID
+ timespec, # Time (2007-09-27T15:29:22Z)
+ succeeded, # 1 or 0
+ role, # enum, see task_role in pk-enum.c
+ duration # in seconds
+ ):
+ pass
# --- PK Methods ---
## Start a new transaction to do Foo
- @dbusException
- @job_id
- def GetUpdates(self, filter="none"):
- """
- Lists packages which could be updated.
- Causes 'Package' signals for each available package.
- """
- return self.pk_iface.GetUpdates(self.tid(), filter)
-
- @dbusException
- @job_id
- def RefreshCache(self,force=False):
- """
- Refreshes the backend's cache.
- """
- return self.pk_iface.RefreshCache(self.tid(),force)
-
- @dbusException
- @job_id
- def UpdateSystem(self):
- """
- Applies all available updates.
- Asynchronous
- """
- return self.pk_iface.UpdateSystem(self.tid())
-
- @dbusException
- @job_id
- def Resolve(self,package_name,filter="none"):
- """
- Finds a package with the given name, and gives back a Package that matches that name exactly
- (not yet supported in yum backend, and maybe others)
- """
- return self.pk_iface.Resolve(self.tid(),filter,package_name)
-
- @dbusException
- @job_id
- def SearchName(self,pattern,filter="none"):
- """
- Searches the 'Name' field for something matching 'pattern'.
- 'filter' could be 'installed', a repository name, or 'none'.
- Causes 'Package' signals for each package found.
- """
- return self.pk_iface.SearchName(self.tid(),filter,pattern)
-
- @dbusException
- @job_id
- def SearchDetails(self,pattern,filter="none"):
- """
- Searches the 'Details' field for something matching 'pattern'.
- 'filter' could be 'installed', a repository name, or 'none'.
- Causes 'Package' signals for each package found.
- """
- return self.pk_iface.SearchDetails(self.tid(),filter,pattern)
-
- @dbusException
- @job_id
- def SearchGroup(self,pattern,filter="none"):
- """
- Lists all packages in groups matching 'pattern'.
- 'filter' could be 'installed', a repository name, or 'none'.
- Causes 'Package' signals for each package found.
- """
- return self.pk_iface.SearchGroup(self.tid(),filter,pattern)
-
- @dbusException
- @job_id
- def SearchFile(self,pattern,filter="none"):
- """
- Lists all packages that provide a file matching 'pattern'.
- 'filter' could be 'installed', a repository name, or 'none'.
- Causes 'Package' signals for each package found.
- """
- return self.pk_iface.SearchFile(self.tid(),filter,pattern)
-
- @dbusException
- @job_id
- def GetDepends(self,package_id,recursive=False):
- """
- Lists package dependancies
- """
- return self.pk_iface.GetDepends(self.tid(),package_id,recursive)
-
- @dbusException
- @job_id
- def GetRequires(self,package_id,recursive):
- """
- Lists package requires
- """
- return self.pk_iface.GetRequires(self.tid(),package_id,recursive)
-
- @dbusException
- @job_id
- def GetUpdateDetail(self,package_id):
- """
- More details about an update.
- """
- return self.pk_iface.GetUpdateDetail(self.tid(),package_id)
-
- @dbusException
- @job_id
- def GetDetails(self,package_id):
- """
- Gets the Details of a given package_id.
- Causes a 'Details' signal.
- """
- return self.pk_iface.GetDetails(self.tid(),package_id)
-
- @dbusException
- @job_id
- def RemovePackages(self,package_ids,allow_deps=False ):
- """
- Removes a package.
- Asynchronous
- """
- return self.pk_iface.RemovePackages(self.tid(),package_ids,allow_deps)
-
- @dbusException
- @job_id
- def InstallPackages(self,package_ids):
- """
- Installs a package.
- Asynchronous
- """
- return self.pk_iface.InstallPackages(self.tid(),package_ids)
-
- @dbusException
- @job_id
- def UpdatePackages(self,package_ids):
- """
- Updates a package.
- Asynchronous
- """
- return self.pk_iface.UpdatePackages(self.tid(),package_ids)
-
- @dbusException
- @job_id
- def InstallFiles(self,full_paths):
- """
- Installs a package which provides given file?
- Asynchronous
- """
- return self.pk_iface.InstallFiles(self.tid(),full_paths)
-
- @dbusException
- @job_id
- def ServicePack(self,location,enabled):
- """
- Updates a service pack from a location
- Asynchronous
- """
- return self.pk_iface.ServicePack(self.tid(),location,enabled)
+ @dbusException
+ @job_id
+ def GetUpdates(self, filter="none"):
+ """
+ Lists packages which could be updated.
+ Causes 'Package' signals for each available package.
+ """
+ return self.pk_iface.GetUpdates(self.tid(), filter)
+
+ @dbusException
+ @job_id
+ def RefreshCache(self, force=False):
+ """
+ Refreshes the backend's cache.
+ """
+ return self.pk_iface.RefreshCache(self.tid(), force)
+
+ @dbusException
+ @job_id
+ def UpdateSystem(self):
+ """
+ Applies all available updates.
+ Asynchronous
+ """
+ return self.pk_iface.UpdateSystem(self.tid())
+
+ @dbusException
+ @job_id
+ def Resolve(self, package_name, filter="none"):
+ """
+ Finds a package with the given name, and gives back a Package that matches that name exactly
+ (not yet supported in yum backend, and maybe others)
+ """
+ return self.pk_iface.Resolve(self.tid(), filter, package_name)
+
+ @dbusException
+ @job_id
+ def SearchName(self, pattern, filter="none"):
+ """
+ Searches the 'Name' field for something matching 'pattern'.
+ 'filter' could be 'installed', a repository name, or 'none'.
+ Causes 'Package' signals for each package found.
+ """
+ return self.pk_iface.SearchName(self.tid(), filter, pattern)
+
+ @dbusException
+ @job_id
+ def SearchDetails(self, pattern, filter="none"):
+ """
+ Searches the 'Details' field for something matching 'pattern'.
+ 'filter' could be 'installed', a repository name, or 'none'.
+ Causes 'Package' signals for each package found.
+ """
+ return self.pk_iface.SearchDetails(self.tid(), filter, pattern)
+
+ @dbusException
+ @job_id
+ def SearchGroup(self, pattern, filter="none"):
+ """
+ Lists all packages in groups matching 'pattern'.
+ 'filter' could be 'installed', a repository name, or 'none'.
+ Causes 'Package' signals for each package found.
+ """
+ return self.pk_iface.SearchGroup(self.tid(), filter, pattern)
+
+ @dbusException
+ @job_id
+ def SearchFile(self, pattern, filter="none"):
+ """
+ Lists all packages that provide a file matching 'pattern'.
+ 'filter' could be 'installed', a repository name, or 'none'.
+ Causes 'Package' signals for each package found.
+ """
+ return self.pk_iface.SearchFile(self.tid(), filter, pattern)
+
+ @dbusException
+ @job_id
+ def GetDepends(self, package_id, recursive=False):
+ """
+ Lists package dependancies
+ """
+ return self.pk_iface.GetDepends(self.tid(), package_id, recursive)
+
+ @dbusException
+ @job_id
+ def GetRequires(self, package_id, recursive):
+ """
+ Lists package requires
+ """
+ return self.pk_iface.GetRequires(self.tid(), package_id, recursive)
+
+ @dbusException
+ @job_id
+ def GetUpdateDetail(self, package_id):
+ """
+ More details about an update.
+ """
+ return self.pk_iface.GetUpdateDetail(self.tid(), package_id)
+
+ @dbusException
+ @job_id
+ def GetDetails(self, package_id):
+ """
+ Gets the Details of a given package_id.
+ Causes a 'Details' signal.
+ """
+ return self.pk_iface.GetDetails(self.tid(), package_id)
+
+ @dbusException
+ @job_id
+ def RemovePackages(self, package_ids, allow_deps=False ):
+ """
+ Removes a package.
+ Asynchronous
+ """
+ return self.pk_iface.RemovePackages(self.tid(), package_ids, allow_deps)
+
+ @dbusException
+ @job_id
+ def InstallPackages(self, package_ids):
+ """
+ Installs a package.
+ Asynchronous
+ """
+ return self.pk_iface.InstallPackages(self.tid(), package_ids)
+
+ @dbusException
+ @job_id
+ def UpdatePackages(self, package_ids):
+ """
+ Updates a package.
+ Asynchronous
+ """
+ return self.pk_iface.UpdatePackages(self.tid(), package_ids)
+
+ @dbusException
+ @job_id
+ def InstallFiles(self, full_paths):
+ """
+ Installs a package which provides given file?
+ Asynchronous
+ """
+ return self.pk_iface.InstallFiles(self.tid(), full_paths)
+
+ @dbusException
+ @job_id
+ def ServicePack(self, location, enabled):
+ """
+ Updates a service pack from a location
+ Asynchronous
+ """
+ return self.pk_iface.ServicePack(self.tid(), location, enabled)
## Do things or query transactions
- @dbusException
- @job_id
- def Cancel(self):
- """
- Might not succeed for all manner or reasons.
- throws NoSuchTransaction
- """
- return self.pk_iface.Cancel(self.tid())
-
- @dbusException
- @job_id
- def GetStatus(self):
- """
- This is what the transaction is currrently doing, and might change.
- Returns status (query,download,install,exit)
- throws NoSuchTransaction
- """
- return self.pk_iface.GetStatus(self.tid())
-
- @dbusException
- @job_id
- def GetRole(self):
- """
- This is the master role, i.e. won't change for the lifetime of the transaction
- Returns status (query,download,install,exit) and package_id (package acted upon, or NULL
- throws NoSuchTransaction
- """
- return self.pk_iface.GetRole(self.tid())
-
- @dbusException
- @job_id
- def GetPercentage(self):
- """
- Returns percentage of transaction complete
- throws NoSuchTransaction
- """
- return self.pk_iface.GetPercentage(self.tid())
-
- @dbusException
- @job_id
- def GetSubPercentage(self):
- """
- Returns percentage of this part of transaction complete
- throws NoSuchTransaction
- """
- return self.pk_iface.GetSubPercentage(self.tid())
-
- @dbusException
- @job_id
- def GetPackage(self):
- """
- Returns package being acted upon at this very moment
- throws NoSuchTransaction
- """
- return self.pk_iface.GetPackage(self.tid())
+ @dbusException
+ @job_id
+ def Cancel(self):
+ """
+ Might not succeed for all manner or reasons.
+ throws NoSuchTransaction
+ """
+ return self.pk_iface.Cancel(self.tid())
+
+ @dbusException
+ @job_id
+ def GetStatus(self):
+ """
+ This is what the transaction is currrently doing, and might change.
+ Returns status (query, download, install, exit)
+ throws NoSuchTransaction
+ """
+ return self.pk_iface.GetStatus(self.tid())
+
+ @dbusException
+ @job_id
+ def GetRole(self):
+ """
+ This is the master role, i.e. won't change for the lifetime of the transaction
+ Returns status (query, download, install, exit) and package_id (package acted upon, or NULL
+ throws NoSuchTransaction
+ """
+ return self.pk_iface.GetRole(self.tid())
+
+ @dbusException
+ @job_id
+ def GetPercentage(self):
+ """
+ Returns percentage of transaction complete
+ throws NoSuchTransaction
+ """
+ return self.pk_iface.GetPercentage(self.tid())
+
+ @dbusException
+ @job_id
+ def GetSubPercentage(self):
+ """
+ Returns percentage of this part of transaction complete
+ throws NoSuchTransaction
+ """
+ return self.pk_iface.GetSubPercentage(self.tid())
+
+ @dbusException
+ @job_id
+ def GetPackage(self):
+ """
+ Returns package being acted upon at this very moment
+ throws NoSuchTransaction
+ """
+ return self.pk_iface.GetPackage(self.tid())
## Get lists of transactions
- @dbusException
- def GetTransactionList(self):
- """
- Returns list of (active) transactions.
- """
- return self.pk_iface.GetTransactionList()
-
- @dbusException
- @job_id
- def GetOldTransactions(self,number=5):
- """
- Causes Transaction signals for each Old transaction.
- """
- return self.pk_iface.GetOldTransactions(self.tid(),number)
+ @dbusException
+ def GetTransactionList(self):
+ """
+ Returns list of (active) transactions.
+ """
+ return self.pk_iface.GetTransactionList()
+
+ @dbusException
+ @job_id
+ def GetOldTransactions(self, number=5):
+ """
+ Causes Transaction signals for each Old transaction.
+ """
+ return self.pk_iface.GetOldTransactions(self.tid(), number)
## General methods
- @dbusException
- def GetBackendDetail(self):
- """
- Returns name, author, and version of backend.
- """
- return self.pk_iface.GetBackendDetail()
-
- @dbusException
- def GetActions(self):
- """
- Returns list of supported actions.
- """
- return self.pk_iface.GetActions()
-
- @dbusException
- def GetGroups(self):
- """
- Returns list of supported groups.
- """
- return self.pk_iface.GetGroups()
-
- @dbusException
- def GetFilters(self):
- """
- Returns list of supported filters.
- """
- return self.pk_iface.GetFilters()
+ @dbusException
+ def GetBackendDetail(self):
+ """
+ Returns name, author, and version of backend.
+ """
+ return self.pk_iface.GetBackendDetail()
+
+ @dbusException
+ def GetActions(self):
+ """
+ Returns list of supported actions.
+ """
+ return self.pk_iface.GetActions()
+
+ @dbusException
+ def GetGroups(self):
+ """
+ Returns list of supported groups.
+ """
+ return self.pk_iface.GetGroups()
+
+ @dbusException
+ def GetFilters(self):
+ """
+ Returns list of supported filters.
+ """
+ return self.pk_iface.GetFilters()
class DumpingPackageKit(PackageKit):
- """
- Just like PackageKit(), but prints all signals instead of handling them
- """
- def catchall_signal_handler(self,*args, **kwargs):
- if kwargs['member'] == "Finished":
- self.loop.quit()
-
- print "Caught signal %s"% kwargs['member']
- print " args:"
- for arg in args:
- print " " + str(arg)
+ """
+ Just like PackageKit(), but prints all signals instead of handling them
+ """
+ def catchall_signal_handler(self, *args, **kwargs):
+ if kwargs['member'] == "Finished":
+ self.loop.quit()
+
+ print "Caught signal %s"% kwargs['member']
+ print " args:"
+ for arg in args:
+ print " " + str(arg)
diff --git a/python/packagekit/misc.py b/python/packagekit/misc.py
index f8c5ac4..e6d113f 100644
--- a/python/packagekit/misc.py
+++ b/python/packagekit/misc.py
@@ -28,60 +28,58 @@ def _to_utf8( obj, errors='replace'):
return obj
class PackageKitPackage:
- '''
- container class from values from the Package signal
'''
- def __init__(self,installed,id,summary):
+ container class from values from the Package signal
+ '''
+ def __init__(self, installed, package_id, summary):
self.installed = (installed == 'installed')
- self.id = str(id)
+ self.id = str(package_id)
self.summary = _to_utf8(summary)
-
+
def __str__(self):
- (name,ver,arch,repo) = tuple(self.id.split(";"))
- p = "%s-%s.%s" % (name,ver,arch)
+ (name, ver, arch, repo) = tuple(self.id.split(";"))
+ p = "%s-%s.%s" % (name, ver, arch)
if self.installed:
inst = "installed"
else:
inst = "available"
return "%-40s : %s : %s" % (p, inst, self.summary)
-
-
+
class PackageKitDistroUpgrade:
- '''
- container class from values from the DistroUpgrade signal
'''
- def __init__(self,upgrade_type,name,summary):
+ container class from values from the DistroUpgrade signal
+ '''
+ def __init__(self, upgrade_type, name, summary):
self.upgrade_type = upgrade_type
self.name = name
self.summary = _to_utf8(summary)
-
+
def __str__(self):
return " type : %s, name : %s, summary : %s " % (
- self.upgrade_type,self.name,self.summmary)
-
+ self.upgrade_type, self.name, self.summary)
class PackageKitDetails:
- '''
- container class from values from the Detail signal
'''
- def __init__(self, id, license, group, detail, url, size):
- self.id = str(id)
- self.license = license
+ container class from values from the Detail signal
+ '''
+ def __init__(self, package_id, package_license, group, detail, url, size):
+ self.id = str(package_id)
+ self.license = package_license
self.group = group
self.detail = _to_utf8(detail)
self.url = url
self.size = size
-
+
class PackageKitUpdateDetails:
- '''
- container class from values from the UpdateDetail signal
'''
- def __init__(self, id, updates, obsoletes, vendor_url, bugzilla_url, \
+ container class from values from the UpdateDetail signal
+ '''
+ def __init__(self, package_id, updates, obsoletes, vendor_url, bugzilla_url, \
cve_url, restart, update_text, changelog, state, \
issued, updated):
- self.id = str(id)
+ self.id = str(package_id)
self.updates = updates
- self.obsoletes = opsoletes
+ self.obsoletes = obsoletes
self.vendor_url = vendor_url
self.bugzilla_url = bugzilla_url
self.cve_url = cve_url
@@ -89,26 +87,23 @@ class PackageKitUpdateDetails:
self.update_text = update_text
self.changelog = changelog
self.state = state
- self.issued = issued
+ self.issued = issued
self.updated = updated
-
+
class PackageKitRepos:
- '''
- container class from values from the Repos signal
'''
- def __init__(self,id, description, enabled):
- self.id = str(id)
+ container class from values from the Repos signal
+ '''
+ def __init__(self, package_id, description, enabled):
+ self.id = str(package_id)
self.description = description
self.enabled = enabled
-
-
+
class PackageKitFiles:
- '''
- container class from values from the Files signal
- '''
- def __init__(self,id, files):
- self.id = str(id)
+ '''
+ container class from values from the Files signal
+ '''
+ def __init__(self, package_id, files):
+ self.id = str(package_id)
self.files = files
-
-
diff --git a/python/packagekit/package.py b/python/packagekit/package.py
index 6c34d14..057af17 100644
--- a/python/packagekit/package.py
+++ b/python/packagekit/package.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
+#
# Copyright (C) 2008
# Richard Hughes <richard at hughsie.com>
@@ -21,16 +21,16 @@ from packagekit.backend import PackageKitEnum
class PackagekitPackage:
- def get_package_id(self,name,version,arch,data):
- return "%s;%s;%s;%s" % (name,version,arch,data)
+ def get_package_id(self, name, version, arch, data):
+ return "%s;%s;%s;%s" % (name, version, arch, data)
- def get_package_from_id(self,id):
+ def get_package_from_id(self, package_id):
''' split up a package id name;ver;arch;data into a tuple
- containing (name,ver,arch,data)
+ containing (name, ver, arch, data)
'''
- return tuple(id.split(';',4))
+ return tuple(package_id.split(';', 4))
- def check_license_field(self,license_field):
+ def check_license_field(self, license_field):
'''
Check the string license_field for free licenses, indicated by
their short names as documented at
@@ -64,8 +64,8 @@ class PackagekitPackage:
one_free_group = False
for group in groups:
- group = group.replace("(","")
- group = group.replace(")","")
+ group = group.replace("(", "")
+ group = group.replace(")", "")
licenses = group.split(" or ")
group_is_free = False
diff --git a/python/packagekit/pkdbus.py b/python/packagekit/pkdbus.py
index 43a104e..3e70bea 100644
--- a/python/packagekit/pkdbus.py
+++ b/python/packagekit/pkdbus.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
+#
# Copyright (C) 2007
# Tim Lauridsen <timlau at fedoraproject.org>
# Tom Parker <palfrey at tevp.net>
@@ -28,10 +28,10 @@ from pkexceptions import PackageKitAccessDenied, PackageKitTransactionFailure
from pkexceptions import PackageKitBackendFailure
def dbusException(func):
- def wrapper(*args,**kwargs):
+ def wrapper(*args, **kwargs):
try:
- return func(*args,**kwargs)
- except dbus.exceptions.DBusException,e:
+ return func(*args, **kwargs)
+ except dbus.exceptions.DBusException, e:
if e.get_dbus_name() == "org.freedesktop.DBus.Error.AccessDenied":
raise PackageKitAccessDenied(e)
elif e.get_dbus_name() == "org.freedesktop.DBus.Error.NoReply":
@@ -48,13 +48,13 @@ class PackageKitDbusInterface:
try:
pk = bus.get_object(service, path)
self.pk_iface = dbus.Interface(pk, dbus_interface=interface)
- except dbus.exceptions.DBusException,e:
+ except dbus.exceptions.DBusException, e:
if e.get_dbus_name() == "org.freedesktop.DBus.Error.ServiceUnknown":
raise PackageKitNotStarted
else:
raise PackageKitException(e)
- bus.add_signal_receiver(self.catchall_signal_handler, interface_keyword='dbus_interface', member_keyword='member',dbus_interface=interface)
+ bus.add_signal_receiver(self.catchall_signal_handler, interface_keyword='dbus_interface', member_keyword='member', dbus_interface=interface)
def catchall_signal_handler(self, *args, **kwargs):
raise NotImplementedError()
diff --git a/python/packagekit/pkexceptions.py b/python/packagekit/pkexceptions.py
index e3481c1..0ef7308 100644
--- a/python/packagekit/pkexceptions.py
+++ b/python/packagekit/pkexceptions.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
+#
# Copyright (C) 2007
# Tim Lauridsen <timlau at fedoraproject.org>
# Tom Parker <palfrey at tevp.net>
@@ -22,37 +22,37 @@
import dbus
class PackageKitException(Exception):
- def __init__(self,e=None):
- Exception.__init__(self)
- if e == None:
- self._pk_name = None
- self._full_str = None
- else:
- if not isinstance(e,dbus.exceptions.DBusException):
- raise Exception,"Can only handle DBusExceptions"
- self._pk_name = str(e.get_dbus_name())
- self._full_str = str(e)
-
- def get_backend_name(self):
- return self._pk_name
-
- def __str__(self):
- if self._full_str!=None:
- return self._full_str
- else:
- return ""
+ def __init__(self, e=None):
+ Exception.__init__(self)
+ if e == None:
+ self._pk_name = None
+ self._full_str = None
+ else:
+ if not isinstance(e, dbus.exceptions.DBusException):
+ raise Exception, "Can only handle DBusExceptions"
+ self._pk_name = str(e.get_dbus_name())
+ self._full_str = str(e)
+
+ def get_backend_name(self):
+ return self._pk_name
+
+ def __str__(self):
+ if self._full_str != None:
+ return self._full_str
+ else:
+ return ""
class PackageKitNotStarted(PackageKitException):
- pass
+ pass
class PackageKitAccessDenied(PackageKitException):
- pass
+ pass
class PackageKitTransactionFailure(PackageKitException):
- pass
+ pass
class PackageKitBackendFailure(PackageKitException):
- pass
+ pass
class PackageKitBackendNotLocked(PackageKitException):
- pass
+ pass
diff --git a/python/packagekit/progress.py b/python/packagekit/progress.py
index 16ee1fc..d0f33f4 100644
--- a/python/packagekit/progress.py
+++ b/python/packagekit/progress.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
+#
# Copyright (C) 2008
# Richard Hughes <richard at hughsie.com>
@@ -27,7 +27,7 @@ class PackagekitProgress:
from packagekit import PackagekitProgress
- steps = [10,30,50,70] # Milestones in %
+ steps = [10, 30, 50, 70] # Milestones in %
progress = PackagekitProgress()
progress.set_steps(steps)
for milestone in range(len(steps)):
@@ -48,7 +48,7 @@ class PackagekitProgress:
self.current_step = 0
self.subpercent = 0
- def set_steps(self,steps):
+ def set_steps(self, steps):
'''
Set the steps for the whole transaction
@param steps: list of int representing the percentage of each step in the transaction
@@ -75,7 +75,7 @@ class PackagekitProgress:
self.percent = 100
self.subpercent = 0
- def set_subpercent(self,pct):
+ def set_subpercent(self, pct):
'''
Set subpercentage and update percentage
'''
commit 1999cc9f209e6b1fde301106af6f2956dd001553
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 25 11:49:53 2008 +0100
trivial: add the pylint file I'm using
diff --git a/python/packagekit/pylint.sh b/python/packagekit/pylint.sh
new file mode 100755
index 0000000..946878c
--- /dev/null
+++ b/python/packagekit/pylint.sh
@@ -0,0 +1 @@
+pylint --disable-msg=W0614,C0301,C0103,W0613,C0111,R0913,R0904 $1
commit 35e7457387b618e81b2c8b8f1a5e35e3ef29b33c
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 25 11:23:07 2008 +0100
trivial: some pylint updates for the yum backend
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 52a5c6c..5c40bd4 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -116,7 +116,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
if lock:
self.doLock()
- def details(self, id, license, group, desc, url, bytes):
+ def details(self, package_id, package_license, group, desc, url, bytes):
'''
Send 'details' signal
@param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
@@ -128,9 +128,9 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
convert the description to UTF before sending
'''
desc = self._to_unicode(desc)
- PackageKitBaseBackend.details(self, id, license, group, desc, url, bytes)
+ PackageKitBaseBackend.details(self, package_id, package_license, group, desc, url, bytes)
- def package(self, id, status, summary):
+ def package(self, package_id, status, summary):
'''
send 'package' signal
@param info: the enumerated INFO_* string
@@ -139,7 +139,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
convert the summary to UTF before sending
'''
summary = self._to_unicode(summary)
- PackageKitBaseBackend.package(self, id, status, summary)
+ PackageKitBaseBackend.package(self, package_id, status, summary)
def _to_unicode(self, txt, encoding='utf-8'):
if isinstance(txt, basestring):
@@ -506,33 +506,33 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
(version, release) = tuple(idver.split('-'))
return epoch, version, release
- def _is_meta_package(self, id):
+ def _is_meta_package(self, package_id):
grp = None
if len(id.split(';')) > 1:
# Split up the id
- (name, idver, a, repo) = self.get_package_from_id(id)
+ (name, idver, a, repo) = self.get_package_from_id(package_id)
if repo == 'meta':
grp = self.yumbase.comps.return_group(name)
if not grp:
self.error(ERROR_PACKAGE_NOT_FOUND, "The Group %s dont exist" % name)
return grp
- def _findPackage(self, id):
+ def _findPackage(self, package_id):
'''
find a package based on a package id (name;version;arch;repoid)
'''
# Bailout if meta packages, just to be sure
- if self._is_meta_package(id):
+ if self._is_meta_package(package_id):
return None, False
# is this an real id or just an name
if len(id.split(';')) > 1:
# Split up the id
- (n, idver, a, d) = self.get_package_from_id(id)
+ (n, idver, a, d) = self.get_package_from_id(package_id)
# get e, v, r from package id version
e, v, r = self._getEVR(idver)
else:
- n = id
+ n = package_id
e = v = r = a = d = None
# search the rpmdb for the nevra
pkgs = self.yumbase.rpmdb.searchNevra(name=n, epoch=e, ver=v, rel=r, arch=a)
@@ -1740,8 +1740,8 @@ class DownloadCallback(BaseMeter):
self.numPkgs = 0
self.bump = 0.0
- def setPackages(self, pkgs, startPct, numPct):
- self.pkgs = pkgs
+ def setPackages(self, new_pkgs, startPct, numPct):
+ self.pkgs = new_pkgs
self.numPkgs = float(len(self.pkgs))
self.bump = numPct/self.numPkgs
self.totalPct = startPct
@@ -1900,21 +1900,18 @@ class ProcessTransPackageKitCallback:
self.base.allow_cancel(True)
self.base.percentage(10)
self.base.status(STATUS_DOWNLOAD)
- if state == PT_DOWNLOAD_PKGS: # Packages to download
+ elif state == PT_DOWNLOAD_PKGS: # Packages to download
self.base.dnlCallback.setPackages(data, 10, 30)
elif state == PT_GPGCHECK:
self.base.percentage(40)
self.base.status(STATUS_SIG_CHECK)
- pass
elif state == PT_TEST_TRANS:
self.base.allow_cancel(False)
self.base.percentage(45)
self.base.status(STATUS_TEST_COMMIT)
- pass
elif state == PT_TRANSACTION:
self.base.allow_cancel(False)
self.base.percentage(50)
- pass
class DepSolveCallback(object):
commit 5c54853d40065cab934ea27835203be5e5e30fb7
Author: Adam Pribyl <covex at lowlevel.cz>
Date: Thu Sep 25 09:44:28 2008 +0000
czech translation update
Transmitted-via: Transifex (translate.fedoraproject.org)
diff --git a/po/cs.po b/po/cs.po
index 1662291..5b47efa 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -1,348 +1,413 @@
# PackageKit Czech translation
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
-# Vojtech Smejkal <smejkalv at gmail.com>, 2008.
#
-#, fuzzy
+# Vojtech Smejkal <smejkalv at gmail.com>, 2008.
+# Adam Pribyl <pribyl at lowlevel.cz>, 2008.
msgid ""
msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: packagekit.master.cs\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-04-18 16:49+0100\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
-"Language-Team: LANGUAGE <LL at li.org>\n"
+"POT-Creation-Date: 2008-08-27 01:23+0000\n"
+"PO-Revision-Date: 2008-08-04 23:26+0200\n"
+"Last-Translator: Adam Pribyl <pribyl at lowlevel.cz>\n"
+"Language-Team: Czech <fedora-cs-list at redhat.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Lokalize 0.2\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: ../policy/org.freedesktop.packagekit.policy.in.h:1
-msgid "Accept EULA"
-msgstr "PÅijmout licenÄnà smlouvu"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:2
-msgid "Authentication is required to accept a EULA"
-msgstr "Pro pÅijetà licenÄnà smlouvy je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:3
-msgid "Authentication is required to change software source parameters"
-msgstr "Pro zmÄnu parametrů zdrojů softwaru je vyžádováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:4
-msgid "Authentication is required to install a local file"
-msgstr "K instalaci mÃstnÃho souboru je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:5
-msgid "Authentication is required to install a package"
-msgstr "K instalaci balÃku je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:6
-msgid "Authentication is required to install a security signature"
-msgstr "K instalaci bezpeÄnostnÃho podpisu je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-msgid "Authentication is required to refresh the package lists"
-msgstr "K obnovenà seznamů balÃků je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to remove packages"
-msgstr "K odstranÄnà balÃků je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid "Authentication is required to rollback a transaction"
-msgstr "K vrácenà akce je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-msgid "Authentication is required to update all packages"
-msgstr "K aktualizaci vÅ¡ech balÃků je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid "Authentication is required to update packages"
-msgstr "K aktualizaci balÃků je vyžadováno oprávnÄnÃ"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid "Change software source parameters"
-msgstr "ZmÄnit parametry zdrojů softwaru"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Install local file"
-msgstr "Nainstalovat mÃstnà soubor"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-msgid "Install package"
-msgstr "Nainstalovat balÃk"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Install security signature"
-msgstr "Nainstalovat bezpeÄnostnà podpis"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Refresh package lists"
-msgstr "Obnovit seznam balÃků"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Remove package"
-msgstr "Odstranit balÃk"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Rollback to a previous transaction"
-msgstr "Vrátit poslednà akci"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid "Update all packages"
-msgstr "Aktualizovat vÅ¡echny balÃky"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-msgid "Update package"
-msgstr "Aktualizovat balÃk"
-
-#: ../client/pk-console.c:208
+#: ../client/pk-console.c:235
msgid "Update detail"
msgstr "Aktualizovat podrobnosti"
-#: ../client/pk-console.c:400
+#: ../client/pk-console.c:452
msgid "A system restart is required"
msgstr "Je požadován restart systému"
-#: ../client/pk-console.c:402
+#: ../client/pk-console.c:454
msgid "A logout and login is required"
msgstr "Je požadováno odhlášenà a pÅihlášenÃ"
-#: ../client/pk-console.c:404
+#: ../client/pk-console.c:456
msgid "An application restart is required"
msgstr "Je vyžadován restart aplikace"
-#: ../client/pk-console.c:443
-#, c-format
-msgid "Please enter a number from 1 to %i: "
-msgstr "ProsÃm zadejte ÄÃslo od 1 do %i: "
-
-#: ../client/pk-console.c:493
-msgid "Could not find a package match"
-msgstr "Nemohu najÃt odpovÃdajÃcà balÃk"
-
-#: ../client/pk-console.c:507
+#: ../client/pk-console.c:549 ../client/pk-generate-pack.c:124
msgid "There are multiple package matches"
msgstr "Danému výrazu odpovÃdá vÃce balÃků"
#. find out what package the user wants to use
-#: ../client/pk-console.c:514
+#: ../client/pk-console.c:556 ../client/pk-generate-pack.c:131
msgid "Please enter the package number: "
msgstr "ProsÃm zadejte ÄÃslo balÃku: "
-#: ../client/pk-console.c:530
-msgid ""
-"Could not find a package with that name to install, or package already "
-"installed"
-msgstr ""
-"K danému názvu nemohu najÃt balÃk k nainstalovanà ani balÃk, který "
-"už je nainstalovaný"
+#: ../client/pk-console.c:590
+msgid "Could not find package to install"
+msgstr "Nemohu najÃt balÃk, který se má instalovat"
-#: ../client/pk-console.c:612
-msgid "Could not find a package with that name to remove"
-msgstr "K daného názvu nemohu najÃt balÃk, který se má odstranit"
+#: ../client/pk-console.c:696
+msgid "Could not find package to remove"
+msgstr "Nemohu najÃt balÃk, který se má odstranit"
-#: ../client/pk-console.c:652
+#: ../client/pk-console.c:757
msgid "The following packages have to be removed"
msgstr "NásledujÃcà balÃky musà být odstranÄny"
#. get user input
-#: ../client/pk-console.c:661
+#: ../client/pk-console.c:764
msgid "Okay to remove additional packages?"
msgstr "SouhlasÃte s odstranÄnÃm doplÅkových balÃků?"
-#: ../client/pk-console.c:665
+#: ../client/pk-console.c:768 ../client/pk-generate-pack.c:523
+#: ../client/pk-generate-pack-main.c:131
msgid "Cancelled!"
msgstr "Zrušeno!"
-#: ../client/pk-console.c:687
-msgid "Could not find a package with that name to update"
-msgstr "K daného názvu nemohu najÃt balÃk, který se má aktualizovat"
+#: ../client/pk-console.c:802
+msgid "Could not find package to download"
+msgstr "Nemohu najÃt balÃk, který se má stáhnout"
-#: ../client/pk-console.c:705
-msgid "Could not find what packages require this package"
-msgstr "Nemohu zjistit, které balÃky vyžadujà tento balÃk"
+#: ../client/pk-console.c:853
+msgid "Could not find package to update"
+msgstr "Nemohu najÃt balÃk, který se má aktualizovat"
-#: ../client/pk-console.c:723
-msgid "Could not get dependencies for this package"
-msgstr "Nemohu zÃskat závislosti pro tento balÃk"
+#: ../client/pk-console.c:875
+msgid "Could not find what packages require"
+msgstr "Nemohu zjistit, které balÃky jsou vyžadovány"
-#: ../client/pk-console.c:741
-msgid "Could not find a description for this package"
-msgstr "Nemohu zÃskat popis tohoto balÃku"
+#: ../client/pk-console.c:896
+msgid "Could not get dependencies for"
+msgstr "Nemohu zÃskat závislosti pro"
-#: ../client/pk-console.c:759
-#, c-format
+#: ../client/pk-console.c:917
+msgid "Could not find details for"
+msgstr "Nemohu zjistit detaily pro"
+
+#: ../client/pk-console.c:940
msgid "Could not find the files for this package"
msgstr "Nemohu nalézt soubory pro tento balÃk"
-#: ../client/pk-console.c:819
+#: ../client/pk-console.c:947
+msgid "Could not get the file list"
+msgstr "Nemohu zÃskat seznam souborů"
+
+#: ../client/pk-console.c:966
+msgid "Could not find the update details for"
+msgstr "Nemohu nalézt podrobnosti o aktualizaci pro"
+
+#: ../client/pk-console.c:1027
msgid "Package description"
msgstr "Popis balÃku"
-#: ../client/pk-console.c:842
+#: ../client/pk-console.c:1060
msgid "Package files"
msgstr "Soubory v balÃku"
-#: ../client/pk-console.c:850
+#: ../client/pk-console.c:1068
msgid "No files"
msgstr "Žádné soubory"
#. get user input
-#: ../client/pk-console.c:882
+#: ../client/pk-console.c:1100
msgid "Okay to import key?"
msgstr "Chcete importovat klÃÄ?"
-#: ../client/pk-console.c:885
+#: ../client/pk-console.c:1103
msgid "Did not import key"
msgstr "KlÃÄ nebyl importován"
#. get user input
-#: ../client/pk-console.c:925
+#: ../client/pk-console.c:1143
msgid "Do you agree?"
msgstr "SouhlasÃte?"
-#: ../client/pk-console.c:928
+#: ../client/pk-console.c:1146
msgid "Did not agree to licence, task will fail"
msgstr "Nesouhlasil/a jste s licencÃ, akce bude zruÅ¡ena"
-#: ../client/pk-console.c:957
+#: ../client/pk-console.c:1175
msgid "The daemon crashed mid-transaction!"
msgstr "Démon havaroval bÄhem Äinnosti!"
#. header
-#: ../client/pk-console.c:1010
+#: ../client/pk-console.c:1228
msgid "PackageKit Console Interface"
msgstr "Konzolové rozhranà PackageKitu"
-#: ../client/pk-console.c:1010
+#: ../client/pk-console.c:1228
msgid "Subcommands:"
msgstr "DÃlÄÃ pÅÃkazy:"
-#: ../client/pk-console.c:1114 ../client/pk-monitor.c:100 ../src/pk-main.c:189
+#: ../client/pk-console.c:1338 ../client/pk-generate-pack-main.c:64
+#: ../client/pk-monitor.c:104 ../src/pk-main.c:189
msgid "Show extra debugging information"
msgstr "Zobrazit dodateÄné ladÃcà informace"
-#: ../client/pk-console.c:1116 ../client/pk-monitor.c:102
+#: ../client/pk-console.c:1340 ../client/pk-monitor.c:106
msgid "Show the program version and exit"
msgstr "Zobrazit verzi programu a ukonÄit se"
-#: ../client/pk-console.c:1118
+#: ../client/pk-console.c:1342
msgid "Set the filter, e.g. installed"
msgstr "Nastavit filtr, napÅ. nainstalované"
-#: ../client/pk-console.c:1120
+#: ../client/pk-console.c:1344
msgid "Exit without waiting for actions to complete"
msgstr "UkonÄit bez varovanà o nedokonÄených akcÃch"
-#: ../client/pk-console.c:1143
+#: ../client/pk-console.c:1367
msgid "Could not connect to system DBUS."
msgstr "Nemohu se pÅipojit k systému DBUS"
-#: ../client/pk-console.c:1231
-#, c-format
-msgid "You need to specify a search type"
-msgstr "Je nutné stanovit typ vyhledávánÃ"
+#: ../client/pk-console.c:1464
+msgid "You need to specify a search type, e.g. name"
+msgstr "Je nutné stanovit typ vyhledávánÃ, napÅ. jméno"
-#: ../client/pk-console.c:1236 ../client/pk-console.c:1243
-#: ../client/pk-console.c:1250 ../client/pk-console.c:1257
-#: ../client/pk-console.c:1361 ../client/pk-console.c:1368
-#: ../client/pk-console.c:1375 ../client/pk-console.c:1382
-#, c-format
+#: ../client/pk-console.c:1469 ../client/pk-console.c:1476
+#: ../client/pk-console.c:1483 ../client/pk-console.c:1490
+#: ../client/pk-console.c:1601 ../client/pk-console.c:1611
+#: ../client/pk-console.c:1618 ../client/pk-console.c:1625
msgid "You need to specify a search term"
msgstr "Je nutné uvést termÃn, který se bude hledat"
-#: ../client/pk-console.c:1262
-#, c-format
+#: ../client/pk-console.c:1495
msgid "Invalid search type"
msgstr "Neplatný typ vyhledávánÃ"
-#: ../client/pk-console.c:1267
-#, c-format
+#: ../client/pk-console.c:1500
msgid "You need to specify a package or file to install"
msgstr "Vyberte balÃk nebo soubor, která se bude instalovat"
-#: ../client/pk-console.c:1280
-#, c-format
+#: ../client/pk-console.c:1507
msgid "You need to specify a type, key_id and package_id"
msgstr "Je nutné urÄit typ, key_id a package_id"
-#: ../client/pk-console.c:1287
-#, c-format
+#: ../client/pk-console.c:1514
msgid "You need to specify a package to remove"
msgstr "Vyberte balÃk, který se má odstranit"
-#: ../client/pk-console.c:1294
-#, c-format
+#: ../client/pk-console.c:1520
+msgid ""
+"You need to specify the destination directory and then the packages to "
+"download"
+msgstr "Je nutné urÄit cÃlový adresáŠa poté balÃk, který se má stáhnout"
+
+#: ../client/pk-console.c:1525
+msgid "Directory not found"
+msgstr "AdresáŠnenalezen"
+
+#: ../client/pk-console.c:1531
msgid "You need to specify a eula-id"
msgstr "Je nutné urÄit eula-id"
-#: ../client/pk-console.c:1309
-#, c-format
+#: ../client/pk-console.c:1547
msgid "You need to specify a package name to resolve"
msgstr "K vyÅeÅ¡enà je nutné uvést název balÃku"
-#: ../client/pk-console.c:1316 ../client/pk-console.c:1323
-#, c-format
+#: ../client/pk-console.c:1556 ../client/pk-console.c:1563
msgid "You need to specify a repo name"
msgstr "Je nutné urÄit název repozitáÅe"
-#: ../client/pk-console.c:1330
-#, c-format
+#: ../client/pk-console.c:1570
msgid "You need to specify a repo name/parameter and value"
msgstr "Je nutné urÄit název/parametr a hodnotu repozitáÅe"
-#: ../client/pk-console.c:1343
-#, c-format
+#: ../client/pk-console.c:1583
msgid "You need to specify a time term"
msgstr "Je nutné urÄit Äasový termÃn"
-#: ../client/pk-console.c:1348
-#, c-format
+#: ../client/pk-console.c:1588
msgid "You need to specify a correct role"
msgstr "Je nutné urÄit správnou roli"
-#: ../client/pk-console.c:1353
-#, c-format
+#: ../client/pk-console.c:1593
msgid "Failed to get last time"
msgstr "NepodaÅilo se zÃskat poslednà Äas"
-#: ../client/pk-console.c:1389
-#, c-format
-msgid "You need to specify a package to find the description for"
-msgstr "Je nutné urÄit balÃk, pro který se má najÃt popis"
+#: ../client/pk-console.c:1632
+msgid "You need to specify a package to find the details for"
+msgstr "Je nutné urÄit balÃk, pro který se majà najÃt podrobnosti"
-#: ../client/pk-console.c:1396
-#, c-format
+#: ../client/pk-console.c:1639
msgid "You need to specify a package to find the files for"
msgstr "Je nutné urÄit balÃk, pro který se majà najÃt soubory"
-#: ../client/pk-console.c:1441
+#: ../client/pk-console.c:1688
#, c-format
msgid "Option '%s' not supported"
msgstr "Volba '%s' nenà podporována"
-#: ../client/pk-console.c:1452
+#: ../client/pk-console.c:1701
+msgid "You don't have the necessary privileges for this operation"
+msgstr "Nemáte nezbytné oprávnÄnà pro tuto operaci"
+
+#: ../client/pk-console.c:1703
msgid "Command failed"
msgstr "PÅÃkaz selhal"
-#: ../client/pk-console.c:1456
-msgid "You don't have the necessary privileges for this operation"
-msgstr "Nemáte nezbytné oprávnÄnà pro tuto operaci"
+#: ../client/pk-generate-pack.c:115
+msgid "Could not find a package match"
+msgstr "Nemohu najÃt odpovÃdajÃcà balÃk"
-#: ../client/pk-monitor.c:113
-msgid "PackageKit Monitor"
-msgstr "PackageKit Monitor"
+#: ../client/pk-generate-pack.c:149
+msgid "failed to download: invalid package_id and/or directory"
+msgstr "stahovánà selhala: neplatné package_id a/nebo adresáÅ"
+
+#: ../client/pk-generate-pack.c:230
+msgid "Could not find a valid metadata file"
+msgstr "Nemohu najÃt platný soubor metadat"
+
+#. get user input
+#: ../client/pk-generate-pack.c:519
+msgid "Okay to download the additional packages"
+msgstr "SouhlasÃte s staženÃm doplÅkových balÃků"
+
+#: ../client/pk-generate-pack-main.c:66
+msgid ""
+"Set the path of the file with the list of packages/dependencies to be "
+"excluded"
+msgstr ""
+"Nastavte cestu k souboru se seznamem balÃÄků/závislostà které majà být "
+"vynechány"
+
+#: ../client/pk-generate-pack-main.c:111
+msgid "You need to specify the pack name and packages to be packed\n"
+msgstr "MusÃte urÄit jméno balÃku a balÃÄky, které majà být zabaleny\n"
+
+#: ../client/pk-generate-pack-main.c:117
+msgid ""
+"Invalid name for the service pack, Specify a name with .servicepack "
+"extension\n"
+msgstr ""
+"Neplatné jméno opravného balÃÄku. Zadejte jméno s pÅÃponou "
+".servicepack\n"
+
+#: ../client/pk-generate-pack-main.c:129
+msgid "A pack with the same name already exists, do you want to overwrite it?"
+msgstr "BalÃk se stejným jménem už existuje, chcete jej pÅepsat?"
+
+#: ../client/pk-generate-pack-main.c:142
+msgid "Failed to create directory"
+msgstr "NepodaÅilo se vytvoÅit adresáÅ"
-#: ../client/pk-import-desktop.c:283 ../client/pk-import-specspo.c:169
+#: ../client/pk-generate-pack-main.c:149
+msgid "Failed to create pack"
+msgstr "NepodaÅilo se vytvoÅit balÃk"
+
+#: ../client/pk-import-desktop.c:279 ../client/pk-import-specspo.c:177
#, c-format
msgid "Could not open database: %s"
msgstr "Nemohu otevÅÃt databázi: %s"
-#: ../client/pk-import-desktop.c:284 ../client/pk-import-specspo.c:170
+#: ../client/pk-import-desktop.c:280 ../client/pk-import-specspo.c:178
msgid "You probably need to run this program as the root user"
msgstr "NejspÃÅ¡e budete muset spustit tento program jako superuživatel"
+#: ../client/pk-monitor.c:117
+msgid "PackageKit Monitor"
+msgstr "PackageKit Monitor"
+
+#: ../client/pk-tools-common.c:51
+#, c-format
+msgid "Please enter a number from 1 to %i: "
+msgstr "ProsÃm zadejte ÄÃslo od 1 do %i: "
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:300
+msgid "Getting package information..."
+msgstr "ZjiÅ¡Å¥uji informace o balÃÄcÃch..."
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:304
+#, c-format
+msgid "<span color='#%06x' underline='single' size='larger'>Run %s</span>"
+msgstr "<span color='#%06x' underline='single' size='larger'>Spustit %s</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:308
+#: ../contrib/packagekit-plugin/src/contents.cpp:313
+#: ../contrib/packagekit-plugin/src/contents.cpp:336
+#: ../contrib/packagekit-plugin/src/contents.cpp:340
+#, c-format
+msgid "<big>%s</big>"
+msgstr "<big>%s</big>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:310
+#, c-format
+msgid ""
+"\n"
+"<small>Installed version: %s</small>"
+msgstr ""
+"\n"
+"<small>Nainstalované verze: %s</small>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:316
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Run version %s now</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Ihned spustit verzi %s</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:321
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Run now</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Ihned spustit</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:325
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Upgrade to version %s</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Aktualizovat na verzi %s</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:330
+#, c-format
+msgid ""
+"<span color='#%06x' underline='single' size='larger'>Install %s Now</span>"
+msgstr ""
+"<span color='#%06x' underline='single' size='larger'>Ihned instalovat %s<"
+"/span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:333
+#, c-format
+msgid ""
+"\n"
+"<small>Version: %s</small>"
+msgstr ""
+"\n"
+"<small>Verze: %s</small>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:337
+msgid ""
+"\n"
+"<small>No packages found for your system</small>"
+msgstr ""
+"\n"
+"<small>Pro váš systém nebyly nalezeny žádné balÃÄky</small>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:341
+msgid ""
+"\n"
+"<small>Installing...</small>"
+msgstr ""
+"\n"
+"<small>Instaluji...</small>"
+
+#: ../data/packagekit-catalog.xml.in.h:1
+msgid "PackageKit Catalog"
+msgstr "PackageKit Katalog"
+
+#: ../data/packagekit-pack.xml.in.h:1
+msgid "PackageKit Service Pack"
+msgstr "BalÃcà služba PackageKit"
+
#: ../src/pk-main.c:83
msgid "Startup failed due to security policies on this machine."
msgstr "SpuÅ¡tÄnà selhalo kvůli bezpeÄnostà politice na tomto stroji"
@@ -360,8 +425,8 @@ msgid ""
"The org.freedesktop.PackageKit.conf file is not installed in the system /etc/"
"dbus-1/system.d directory"
msgstr ""
-"Soubor org.freedesktop.PackageKit.conf nenà nainstalován v systémovém adresáÅi"
-"/etc/dbus-1/system.d"
+"Soubor org.freedesktop.PackageKit.conf nenà nainstalován v systémovém "
+"adresáÅi/etc/dbus-1/system.d"
#: ../src/pk-main.c:185
msgid "Packaging backend to use, e.g. dummy"
@@ -381,7 +446,7 @@ msgstr "Zobrazit verzi a ukonÄit se"
#: ../src/pk-main.c:195
msgid "Exit after a small delay"
-msgstr "UkonÄit se krátkým zpoždÄnÃm"
+msgstr "UkonÄit se s krátkým zpoždÄnÃm"
#: ../src/pk-main.c:197
msgid "Exit after the engine has loaded"
@@ -399,3 +464,80 @@ msgstr "Nemohu se pÅipojit k systémové sbÄrnici"
#, c-format
msgid "Error trying to start: %s\n"
msgstr "Chyba pÅi pokusu o spuÅ¡tÄnÃ: %s\n"
+
+#~ msgid "Accept EULA"
+#~ msgstr "PÅijmout licenÄnà smlouvu"
+
+#~ msgid "Authentication is required to accept a EULA"
+#~ msgstr "Pro pÅijetà licenÄnà smlouvy je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to change software source parameters"
+#~ msgstr "Pro zmÄnu parametrů zdrojů softwaru je vyžádováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to install a local file"
+#~ msgstr "K instalaci mÃstnÃho souboru je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to install a package"
+#~ msgstr "K instalaci balÃku je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to install a security signature"
+#~ msgstr "K instalaci bezpeÄnostnÃho podpisu je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to refresh the package lists"
+#~ msgstr "K obnovenà seznamů balÃků je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to remove packages"
+#~ msgstr "K odstranÄnà balÃků je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to rollback a transaction"
+#~ msgstr "K vrácenà akce je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to update all packages"
+#~ msgstr "K aktualizaci vÅ¡ech balÃků je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Authentication is required to update packages"
+#~ msgstr "K aktualizaci balÃků je vyžadováno oprávnÄnÃ"
+
+#~ msgid "Change software source parameters"
+#~ msgstr "ZmÄnit parametry zdrojů softwaru"
+
+#~ msgid "Install local file"
+#~ msgstr "Nainstalovat mÃstnà soubor"
+
+#~ msgid "Install package"
+#~ msgstr "Nainstalovat balÃk"
+
+#~ msgid "Install security signature"
+#~ msgstr "Nainstalovat bezpeÄnostnà podpis"
+
+#~ msgid "Refresh package lists"
+#~ msgstr "Obnovit seznam balÃků"
+
+#~ msgid "Remove package"
+#~ msgstr "Odstranit balÃk"
+
+#~ msgid "Rollback to a previous transaction"
+#~ msgstr "Vrátit poslednà akci"
+
+#~ msgid "Update all packages"
+#~ msgstr "Aktualizovat vÅ¡echny balÃky"
+
+#~ msgid "Update package"
+#~ msgstr "Aktualizovat balÃk"
+
+#~ msgid ""
+#~ "Could not find a package with that name to install, or package already "
+#~ "installed"
+#~ msgstr ""
+#~ "K danému názvu nemohu najÃt balÃk k nainstalovanà ani balÃk, který už je "
+#~ "nainstalovaný"
+
+#~ msgid "Could not find a package with that name to update"
+#~ msgstr "K daného názvu nemohu najÃt balÃk, který se má aktualizovat"
+
+#~ msgid "Could not find a description for this package"
+#~ msgstr "Nemohu zÃskat popis tohoto balÃku"
+
+#~ msgid "You need to specify a package to find the description for"
+#~ msgstr "Je nutné urÄit balÃk, pro který se má najÃt popis"
+
commit 1d322a23c4a49631b29972276b29158b4d9bb1e4
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 24 18:03:34 2008 +0100
trivial: fix whitespace in the yum backend to make pylint a wee bit happier
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 6fd0262..52a5c6c 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -28,12 +28,12 @@ from packagekit.backend import *
from packagekit.progress import *
from packagekit.package import PackagekitPackage
import yum
-from urlgrabber.progress import BaseMeter,format_time,format_number
+from urlgrabber.progress import BaseMeter, format_time, format_number
from yum.rpmtrans import RPMBaseCallback
from yum.constants import *
from yum.update_md import UpdateMetadata
from yum.callbacks import *
-from yum.misc import prco_tuple_to_string,unique
+from yum.misc import prco_tuple_to_string, unique
from yum.packages import YumLocalPackage, parsePackages
from yum.packageSack import MetaSack
import rpmUtils
@@ -68,55 +68,55 @@ MetaDataMap = {
class GPGKeyNotImported(exceptions.Exception):
pass
-def sigquit(signum,frame):
- print >> sys.stderr,"Quit signal sent - exiting immediately"
+def sigquit(signum, frame):
+ print >> sys.stderr, "Quit signal sent - exiting immediately"
if yumbase:
- print >> sys.stderr,"unlocking backend"
+ print >> sys.stderr, "unlocking backend"
yumbase.closeRpmDB()
yumbase.doUnlock(YUM_PID_FILE)
sys.exit(1)
-class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
+class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
# Packages there require a reboot
- rebootpkgs = ("kernel","kernel-smp","kernel-xen-hypervisor","kernel-PAE",
- "kernel-xen0","kernel-xenU","kernel-xen","kernel-xen-guest",
- "glibc","hal","dbus","xen")
+ rebootpkgs = ("kernel", "kernel-smp", "kernel-xen-hypervisor", "kernel-PAE",
+ "kernel-xen0", "kernel-xenU", "kernel-xen", "kernel-xen-guest",
+ "glibc", "hal", "dbus", "xen")
def handle_repo_error(func):
- def wrapper(*args,**kwargs):
+ def wrapper(*args, **kwargs):
self = args[0]
try:
- func(*args,**kwargs)
- except yum.Errors.RepoError,e:
+ func(*args, **kwargs)
+ except yum.Errors.RepoError, e:
self._refresh_yum_cache()
try:
- func(*args,**kwargs)
- except yum.Errors.RepoError,e:
- self.error(ERROR_NO_CACHE,str(e))
+ func(*args, **kwargs)
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_NO_CACHE, str(e))
return wrapper
- def __init__(self,args,lock=True):
- signal.signal(signal.SIGQUIT,sigquit)
- PackageKitBaseBackend.__init__(self,args)
+ def __init__(self, args, lock=True):
+ signal.signal(signal.SIGQUIT, sigquit)
+ PackageKitBaseBackend.__init__(self, args)
self.yumbase = PackageKitYumBase(self)
self._lang = os.environ['LANG']
self.comps = yumComps(self.yumbase)
if not self.comps.connect():
self.refresh_cache()
if not self.comps.connect():
- self.error(ERROR_GROUP_LIST_INVALID,'comps categories could not be loaded')
+ self.error(ERROR_GROUP_LIST_INVALID, 'comps categories could not be loaded')
yumbase = self.yumbase
self._setup_yum()
if lock:
self.doLock()
- def details(self,id,license,group,desc,url,bytes):
+ def details(self, id, license, group, desc, url, bytes):
'''
Send 'details' signal
@param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
@@ -128,9 +128,9 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
convert the description to UTF before sending
'''
desc = self._to_unicode(desc)
- PackageKitBaseBackend.details(self,id,license,group,desc,url,bytes)
+ PackageKitBaseBackend.details(self, id, license, group, desc, url, bytes)
- def package(self,id,status,summary):
+ def package(self, id, status, summary):
'''
send 'package' signal
@param info: the enumerated INFO_* string
@@ -139,12 +139,12 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
convert the summary to UTF before sending
'''
summary = self._to_unicode(summary)
- PackageKitBaseBackend.package(self,id,status,summary)
+ PackageKitBaseBackend.package(self, id, status, summary)
- def _to_unicode(self,txt,encoding='utf-8'):
- if isinstance(txt,basestring):
- if not isinstance(txt,unicode):
- txt = unicode(txt,encoding,errors='replace')
+ def _to_unicode(self, txt, encoding='utf-8'):
+ if isinstance(txt, basestring):
+ if not isinstance(txt, unicode):
+ txt = unicode(txt, encoding, errors='replace')
return txt
def doLock(self):
@@ -158,7 +158,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
time.sleep(2)
retries += 1
if retries > 100:
- self.error(ERROR_CANNOT_GET_LOCK,'Yum is locked by another application')
+ self.error(ERROR_CANNOT_GET_LOCK, 'Yum is locked by another application')
def unLock(self):
''' Unlock Yum'''
@@ -167,25 +167,25 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self.yumbase.closeRpmDB()
self.yumbase.doUnlock(YUM_PID_FILE)
- def _get_package_ver(self,po):
+ def _get_package_ver(self, po):
''' return the a ver as epoch:version-release or version-release, if epoch=0'''
if po.epoch != '0':
- ver = "%s:%s-%s" % (po.epoch,po.version,po.release)
+ ver = "%s:%s-%s" % (po.epoch, po.version, po.release)
else:
- ver = "%s-%s" % (po.version,po.release)
+ ver = "%s-%s" % (po.version, po.release)
return ver
- def _get_nevra(self,pkg):
+ def _get_nevra(self, pkg):
''' gets the NEVRA for a pkg '''
- return "%s-%s:%s-%s.%s" % (pkg.name,pkg.epoch,pkg.version,pkg.release,pkg.arch)
+ return "%s-%s:%s-%s.%s" % (pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch)
- def _do_meta_package_search(self,filters,key):
+ def _do_meta_package_search(self, filters, key):
grps = self.comps.get_meta_packages()
for grpid in grps:
if key in grpid:
- self._show_meta_package(grpid,filters)
+ self._show_meta_package(grpid, filters)
- def set_locale(self,code):
+ def set_locale(self, code):
'''
Implement the {backend}-set-locale functionality
Needed to be implemented in a sub class
@@ -193,14 +193,14 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self._lang = code
@handle_repo_error
- def _do_search(self,searchlist,filters,key):
+ def _do_search(self, searchlist, filters, key):
'''
Search for yum packages
@param searchlist: The yum package fields to search in
- @param filters: package types to search (all,installed,available)
+ @param filters: package types to search (all, installed, available)
@param key: key to seach for
'''
- res = self.yumbase.searchGenerator(searchlist,[key])
+ res = self.yumbase.searchGenerator(searchlist, [key])
fltlist = filters.split(';')
pkgfilter = YumFilter(fltlist)
package_list = [] #we can't do emitting as found if we are post-processing
@@ -208,12 +208,12 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
available = []
if FILTER_NOT_COLLECTIONS not in fltlist:
- self._do_meta_package_search(fltlist,key)
+ self._do_meta_package_search(fltlist, key)
if FILTER_COLLECTIONS in fltlist:
return
- for (pkg,values) in res:
+ for (pkg, values) in res:
if pkg.repo.id == 'installed':
installed.append(pkg)
else:
@@ -226,11 +226,11 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
package_list = pkgfilter.post_process()
self._show_package_list(package_list)
- def _show_package_list(self,lst):
- for (pkg,status) in lst:
- self._show_package(pkg,status)
+ def _show_package_list(self, lst):
+ for (pkg, status) in lst:
+ self._show_package(pkg, status)
- def search_name(self,filters,key):
+ def search_name(self, filters, key):
'''
Implement the {backend}-search-name functionality
'''
@@ -241,34 +241,34 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
searchlist = ['name']
self.status(STATUS_QUERY)
- self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
- self._do_search(searchlist,filters,key)
+ self.yumbase.doConfigSetup(errorlevel=0, debuglevel=0)# Setup Yum Config
+ self._do_search(searchlist, filters, key)
- def search_details(self,filters,key):
+ def search_details(self, filters, key):
'''
Implement the {backend}-search-details functionality
'''
self._check_init(lazy_cache=True)
- self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
+ self.yumbase.doConfigSetup(errorlevel=0, debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 0 # Allow new files
self.allow_cancel(True)
self.percentage(None)
- searchlist = ['name','summary','description','group']
+ searchlist = ['name', 'summary', 'description', 'group']
self.status(STATUS_QUERY)
- self._do_search(searchlist,filters,key)
+ self._do_search(searchlist, filters, key)
- def _get_installed_from_names(self,name_list):
+ def _get_installed_from_names(self, name_list):
found = []
for package in name_list:
pkgs = self.yumbase.rpmdb.searchNevra(name=package)
found.extend(pkgs)
return found
- def _get_available_from_names(self,name_list):
+ def _get_available_from_names(self, name_list):
return self.yumbase.pkgSack.searchNames(names=name_list)
- def _handle_collections(self,fltlist):
+ def _handle_collections(self, fltlist):
"""
Handle the special collection group
"""
@@ -285,10 +285,10 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
if i % 10 == 0:
pct += step
self.percentage(pct)
- self._show_meta_package(col,fltlist)
+ self._show_meta_package(col, fltlist)
self.percentage(100)
- def _show_meta_package(self,grpid,fltlist=[]):
+ def _show_meta_package(self, grpid, fltlist=[]):
show_avail = FILTER_INSTALLED not in fltlist
show_inst = FILTER_NOT_INSTALLED not in fltlist
package_id = "%s;;;meta" % grpid
@@ -297,19 +297,19 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
name = grp.nameByLang(self._lang)
if grp.installed:
if show_inst:
- self.package(package_id,INFO_COLLECTION_INSTALLED,name)
+ self.package(package_id, INFO_COLLECTION_INSTALLED, name)
else:
if show_avail:
- self.package(package_id,INFO_COLLECTION_AVAILABLE,name)
+ self.package(package_id, INFO_COLLECTION_AVAILABLE, name)
#@handle_repo_error
- def search_group(self,filters,group_key):
+ def search_group(self, filters, group_key):
'''
Implement the {backend}-search-group functionality
'''
self._check_init(lazy_cache=True)
self.allow_cancel(True)
- self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
+ self.yumbase.doConfigSetup(errorlevel=0, debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 0 # TODO: can we just look in the cache?
self.status(STATUS_QUERY)
package_list = [] #we can't do emitting as found if we are post-processing
@@ -347,16 +347,16 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self.percentage(100)
@handle_repo_error
- def get_packages(self,filters):
+ def get_packages(self, filters):
'''
Search for yum packages
@param searchlist: The yum package fields to search in
- @param filters: package types to search (all,installed,available)
+ @param filters: package types to search (all, installed, available)
@param key: key to seach for
'''
self.status(STATUS_QUERY)
self.allow_cancel(True)
- self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
+ self.yumbase.doConfigSetup(errorlevel=0, debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 0 # TODO: can we just look in the cache?
package_list = [] #we can't do emitting as found if we are post-processing
@@ -377,7 +377,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self._show_package_list(package_list)
@handle_repo_error
- def search_file(self,filters,key):
+ def search_file(self, filters, key):
'''
Implement the {backend}-search-file functionality
'''
@@ -407,7 +407,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self._show_package_list(package_list)
@handle_repo_error
- def what_provides(self,filters,provides_type,search):
+ def what_provides(self, filters, provides_type, search):
'''
Implement the {backend}-what-provides functionality
'''
@@ -434,7 +434,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self._show_package_list(package_list)
@handle_repo_error
- def download_packages(self,directory,package_ids):
+ def download_packages(self, directory, package_ids):
'''
Implement the {backend}-download-packages functionality
'''
@@ -449,31 +449,31 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
# download each package
for package in package_ids:
self.percentage(percentage)
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
# if we couldn't map package_id -> pkg
if not pkg:
- self.message(MESSAGE_COULD_NOT_FIND_PACKAGE,"Could not find the package %s" % package)
+ self.message(MESSAGE_COULD_NOT_FIND_PACKAGE, "Could not find the package %s" % package)
continue
- n,a,e,v,r = pkg.pkgtup
- packs = self.yumbase.pkgSack.searchNevra(n,e,v,r,a)
+ n, a, e, v, r = pkg.pkgtup
+ packs = self.yumbase.pkgSack.searchNevra(n, e, v, r, a)
# if we couldn't map package_id -> pkg
if len(packs) == 0:
- self.message(MESSAGE_COULD_NOT_FIND_PACKAGE,"Could not find a match for package %s" % package)
+ self.message(MESSAGE_COULD_NOT_FIND_PACKAGE, "Could not find a match for package %s" % package)
continue
# should have only one...
for pkg_download in packs:
- self._show_package(pkg_download,INFO_DOWNLOADING)
+ self._show_package(pkg_download, INFO_DOWNLOADING)
repo = self.yumbase.repos.getRepo(pkg_download.repoid)
remote = pkg_download.returnSimple('relativepath')
local = os.path.basename(remote)
if not os.path.exists(directory):
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,"No destination directory exists")
- local = os.path.join(directory,local)
+ self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, "No destination directory exists")
+ local = os.path.join(directory, local)
if (os.path.exists(local) and os.path.getsize(local) == int(pkg_download.returnSimple('packagesize'))):
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,"Package already exists")
+ self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, "Package already exists")
continue
# Disable cache otherwise things won't download
repo.cache = 0
@@ -482,20 +482,20 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
path = repo.getPackage(pkg_download)
files.append(path)
except IOError, e:
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,"Cannot write to file")
+ self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, "Cannot write to file")
continue
percentage += bump
# emit the file list we downloaded
file_list = ";".join(files)
- self.files(package,file_list)
+ self.files(package, file_list)
# in case we don't sum to 100
self.percentage(100)
- def _getEVR(self,idver):
+ def _getEVR(self, idver):
'''
- get the e,v,r from the package id version
+ get the e, v, r from the package id version
'''
cpos = idver.find(':')
if cpos != -1:
@@ -503,70 +503,70 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
idver = idver[cpos+1:]
else:
epoch = '0'
- (version,release) = tuple(idver.split('-'))
- return epoch,version,release
+ (version, release) = tuple(idver.split('-'))
+ return epoch, version, release
- def _is_meta_package(self,id):
+ def _is_meta_package(self, id):
grp = None
if len(id.split(';')) > 1:
# Split up the id
- (name,idver,a,repo) = self.get_package_from_id(id)
+ (name, idver, a, repo) = self.get_package_from_id(id)
if repo == 'meta':
grp = self.yumbase.comps.return_group(name)
if not grp:
- self.error(ERROR_PACKAGE_NOT_FOUND,"The Group %s dont exist" % name)
+ self.error(ERROR_PACKAGE_NOT_FOUND, "The Group %s dont exist" % name)
return grp
- def _findPackage(self,id):
+ def _findPackage(self, id):
'''
find a package based on a package id (name;version;arch;repoid)
'''
# Bailout if meta packages, just to be sure
if self._is_meta_package(id):
- return None,False
+ return None, False
# is this an real id or just an name
if len(id.split(';')) > 1:
# Split up the id
- (n,idver,a,d) = self.get_package_from_id(id)
- # get e,v,r from package id version
- e,v,r = self._getEVR(idver)
+ (n, idver, a, d) = self.get_package_from_id(id)
+ # get e, v, r from package id version
+ e, v, r = self._getEVR(idver)
else:
n = id
e = v = r = a = d = None
# search the rpmdb for the nevra
- pkgs = self.yumbase.rpmdb.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a)
+ pkgs = self.yumbase.rpmdb.searchNevra(name=n, epoch=e, ver=v, rel=r, arch=a)
# if the package is found, then return it (do not have to match the repo_id)
if len(pkgs) != 0:
- return pkgs[0],True
+ return pkgs[0], True
# search the pkgSack for the nevra
try:
- pkgs = self.yumbase.pkgSack.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a)
- except yum.Errors.RepoError,e:
- self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
+ pkgs = self.yumbase.pkgSack.searchNevra(name=n, epoch=e, ver=v, rel=r, arch=a)
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_REPO_NOT_AVAILABLE, str(e))
# nothing found
if len(pkgs) == 0:
- return None,False
+ return None, False
# one NEVRA in a single repo
if len(pkgs) == 1:
- return pkgs[0],False
+ return pkgs[0], False
# we might have the same NEVRA in multiple repos, match by repo name
for pkg in pkgs:
if d == pkg.repoid:
- return pkg,False
+ return pkg, False
# repo id did not match
- return None,False
+ return None, False
- def _get_pkg_requirements(self,pkg,reqlist=[]):
+ def _get_pkg_requirements(self, pkg, reqlist=[]):
pkgs = self.yumbase.rpmdb.searchRequires(pkg.name)
reqlist.extend(pkgs)
if pkgs:
for po in pkgs:
- self._get_pkg_requirements(po,reqlist)
+ self._get_pkg_requirements(po, reqlist)
else:
return reqlist
- def _text_to_boolean(self,text):
+ def _text_to_boolean(self, text):
'''
Parses true and false
'''
@@ -580,7 +580,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
return True
return False
- def get_requires(self,filters,package_ids,recursive_text):
+ def get_requires(self, filters, package_ids, recursive_text):
'''
Print a list of requires for a given package
'''
@@ -601,26 +601,26 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
grp = self._is_meta_package(package)
if grp:
if not grp.installed:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,"The Group %s is not installed" % grp.groupid)
+ self.error(ERROR_PACKAGE_NOT_INSTALLED, "The Group %s is not installed" % grp.groupid)
else:
txmbr = self.yumbase.groupRemove(grp.groupid)
- rc,msgs = self.yumbase.buildTransaction()
+ rc, msgs = self.yumbase.buildTransaction()
if rc != 2:
- self.error(ERROR_DEP_RESOLUTION_FAILED,self._format_msgs(msgs))
+ self.error(ERROR_DEP_RESOLUTION_FAILED, self._format_msgs(msgs))
else:
for txmbr in self.yumbase.tsInfo:
deps_list.append(txmbr.po)
else:
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
# FIXME: This is a hack, it simulates a removal of the
# package and return the transaction
if inst and pkg:
resolve_list.append(pkg)
txmbrs = self.yumbase.remove(po=pkg)
if txmbrs:
- rc,msgs = self.yumbase.buildTransaction()
+ rc, msgs = self.yumbase.buildTransaction()
if rc != 2:
- self.error(ERROR_DEP_RESOLUTION_FAILED,self._format_msgs(msgs))
+ self.error(ERROR_DEP_RESOLUTION_FAILED, self._format_msgs(msgs))
else:
for txmbr in self.yumbase.tsInfo:
if pkg not in deps_list:
@@ -635,14 +635,14 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
# each unique name, emit
for pkg in deps_list:
package_id = self._pkg_to_id(pkg)
- self.package(package_id,INFO_INSTALLED,pkg.summary)
+ self.package(package_id, INFO_INSTALLED, pkg.summary)
self.percentage(100)
- def _is_inst(self,pkg):
+ def _is_inst(self, pkg):
# search only for requested arch
return self.yumbase.rpmdb.installed(po=pkg)
- def _is_inst_arch(self,pkg):
+ def _is_inst_arch(self, pkg):
# search for a requested arch first
ret = self._is_inst(pkg)
if ret:
@@ -655,7 +655,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
pkg.arch = 'i386'
return ret
- def _installable(self,pkg,ematch=False):
+ def _installable(self, pkg, ematch=False):
"""check if the package is reasonably installable, true/false"""
@@ -667,7 +667,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
return False
# everything installed that matches the name
- installedByKey = self.yumbase.rpmdb.searchNevra(name=pkg.name,arch=pkg.arch)
+ installedByKey = self.yumbase.rpmdb.searchNevra(name=pkg.name, arch=pkg.arch)
comparable = []
for instpo in installedByKey:
if rpmUtils.arch.isMultiLibArch(instpo.arch) == rpmUtils.arch.isMultiLibArch(pkg.arch):
@@ -702,7 +702,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
return False
- def _get_best_pkg_from_list(self,pkglist):
+ def _get_best_pkg_from_list(self, pkglist):
'''
Gets best dep package from a list
'''
@@ -710,8 +710,8 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
# first try and find the highest EVR package that is already installed
for pkgi in pkglist:
- n,a,e,v,r = pkgi.pkgtup
- pkgs = self.yumbase.rpmdb.searchNevra(name=n,epoch=e,ver=v,arch=a)
+ n, a, e, v, r = pkgi.pkgtup
+ pkgs = self.yumbase.rpmdb.searchNevra(name=n, epoch=e, ver=v, arch=a)
for pkg in pkgs:
if best:
if pkg.EVR > best.EVR:
@@ -729,7 +729,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
best = pkg
return best
- def _get_best_depends(self,pkgs,recursive):
+ def _get_best_depends(self, pkgs, recursive):
''' Gets the best deps for a package
@param pkgs: a list of package objects
@param recursive: if we recurse
@@ -747,7 +747,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
for req in results[pkg].keys():
reqlist = results[pkg][req]
if not reqlist: # Unsatisfied dependency
- self.error(ERROR_DEP_RESOLUTION_FAILED,"the (%s) requirement could not be resolved" % prco_tuple_to_string(req),exit=False)
+ self.error(ERROR_DEP_RESOLUTION_FAILED, "the (%s) requirement could not be resolved" % prco_tuple_to_string(req), exit=False)
break
require_list.append(reqlist)
@@ -761,14 +761,14 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
# if the package is to be downloaded, also find its deps
if len(recursive_list) > 0:
- pkgsdeps = self._get_best_depends(recursive_list,True)
+ pkgsdeps = self._get_best_depends(recursive_list, True)
for pkg in pkgsdeps:
if pkg not in pkgs:
deps_list.append(pkg)
return deps_list
- def _get_group_packages(self,grp):
+ def _get_group_packages(self, grp):
'''
Get the packages there will be installed when a comps group
is installed
@@ -787,7 +787,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
return pkgs
- def get_depends(self,filters,package_ids,recursive_text):
+ def get_depends(self, filters, package_ids, recursive_text):
'''
Print a list of depends for a given package
'''
@@ -816,18 +816,18 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
grp_pkgs.extend(pkgs)
else:
name = package.split(';')[0]
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
if pkg:
resolve_list.append(pkg)
else:
- self.error(ERROR_PACKAGE_NOT_FOUND,'Package %s was not found' % package)
+ self.error(ERROR_PACKAGE_NOT_FOUND, 'Package %s was not found' % package)
break
percentage += bump
if grp_pkgs:
resolve_list.extend(grp_pkgs)
# get the best deps
- deps_list = self._get_best_depends(resolve_list,recursive)
+ deps_list = self._get_best_depends(resolve_list, recursive)
# make unique list
deps_list = unique(deps_list)
@@ -867,12 +867,12 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
try:
txmbr = self.yumbase.update() # Add all updates to Transaction
- except yum.Errors.RepoError,e:
- self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_REPO_NOT_AVAILABLE, str(e))
if txmbr:
self._runYumTransaction()
else:
- self.error(ERROR_NO_PACKAGES_TO_UPDATE,"Nothing to do")
+ self.error(ERROR_NO_PACKAGES_TO_UPDATE, "Nothing to do")
self.yumbase.conf.throttle = old_throttle
self.yumbase.conf.skip_broken = old_skip_broken
@@ -896,10 +896,10 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
for repo in self.yumbase.repos.listEnabled():
repo.metadata_expire = 0
- self.yumbase.repos.populateSack(which=[repo.id],mdtype='metadata',cacheonly=1)
+ self.yumbase.repos.populateSack(which=[repo.id], mdtype='metadata', cacheonly=1)
pct += bump
self.percentage(pct)
- self.yumbase.repos.populateSack(which=[repo.id],mdtype='filelists',cacheonly=1)
+ self.yumbase.repos.populateSack(which=[repo.id], mdtype='filelists', cacheonly=1)
pct += bump
self.percentage(pct)
@@ -909,27 +909,27 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
#we might have a rounding error
self.percentage(100)
- except yum.Errors.RepoError,e:
+ except yum.Errors.RepoError, e:
message = self._format_msgs(e.value)
if message.find ("No more mirrors to try") != -1:
- self.error(ERROR_NO_MORE_MIRRORS_TO_TRY,message)
+ self.error(ERROR_NO_MORE_MIRRORS_TO_TRY, message)
else:
- self.error(ERROR_REPO_CONFIGURATION_ERROR,message)
- except yum.Errors.YumBaseError,e:
- self.error(ERROR_UNKNOWN,"cannot refresh cache: %s" % str(e))
+ self.error(ERROR_REPO_CONFIGURATION_ERROR, message)
+ except yum.Errors.YumBaseError, e:
+ self.error(ERROR_UNKNOWN, "cannot refresh cache: %s" % str(e))
# update the comps groups too
self.comps.refresh()
@handle_repo_error
- def resolve(self,filters,packages):
+ def resolve(self, filters, packages):
'''
Implement the {backend}-resolve functionality
'''
self._check_init(lazy_cache=True)
self.allow_cancel(True)
self.percentage(None)
- self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
+ self.yumbase.doConfigSetup(errorlevel=0, debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 0 # TODO: can we just look in the cache?
self.status(STATUS_QUERY)
@@ -939,7 +939,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
installedByKey = self.yumbase.rpmdb.searchNevra(name=package)
if FILTER_NOT_INSTALLED not in fltlist:
for pkg in installedByKey:
- self._show_package(pkg,INFO_INSTALLED)
+ self._show_package(pkg, INFO_INSTALLED)
# Get available packages
if FILTER_INSTALLED not in fltlist:
for pkg in self.yumbase.pkgSack.returnNewestByNameArch():
@@ -950,10 +950,10 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
if pkg.EVR < instpo.EVR or pkg.EVR == instpo.EVR:
show = False
if show:
- self._show_package(pkg,INFO_AVAILABLE)
+ self._show_package(pkg, INFO_AVAILABLE)
@handle_repo_error
- def install_packages(self,package_ids):
+ def install_packages(self, package_ids):
'''
Implement the {backend}-install-packages functionality
This will only work with yum 3.2.4 or higher
@@ -969,39 +969,39 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
grp = self._is_meta_package(package)
if grp:
if grp.installed:
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"This Group %s is already installed" % grp.groupid)
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED, "This Group %s is already installed" % grp.groupid)
txmbr = self.yumbase.selectGroup(grp.groupid)
for t in txmbr:
repo = self.yumbase.repos.getRepo(t.po.repoid)
if not already_warned and not repo.gpgcheck:
- self.message(MESSAGE_UNTRUSTED_PACKAGE,"The untrusted package %s will be installed from %s." % (t.po.name, repo))
+ self.message(MESSAGE_UNTRUSTED_PACKAGE, "The untrusted package %s will be installed from %s." % (t.po.name, repo))
already_warned = True
txmbrs.extend(txmbr)
else:
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
if pkg and not inst:
repo = self.yumbase.repos.getRepo(pkg.repoid)
if not already_warned and not repo.gpgcheck:
- self.message(MESSAGE_UNTRUSTED_PACKAGE,"The untrusted package %s will be installed from %s." % (pkg.name, repo))
+ self.message(MESSAGE_UNTRUSTED_PACKAGE, "The untrusted package %s will be installed from %s." % (pkg.name, repo))
already_warned = True
txmbr = self.yumbase.install(po=pkg)
txmbrs.extend(txmbr)
if inst:
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"The package %s is already installed" % pkg.name)
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED, "The package %s is already installed" % pkg.name)
if txmbrs:
self._runYumTransaction()
else:
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"The packages failed to be installed")
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED, "The packages failed to be installed")
- def _checkForNewer(self,po):
+ def _checkForNewer(self, po):
pkgs = self.yumbase.pkgSack.returnNewestByName(name=po.name)
if pkgs:
newest = pkgs[0]
if newest.EVR > po.EVR:
- self.message(MESSAGE_NEWER_PACKAGE_EXISTS,"A newer version of %s is available online." % po.name)
+ self.message(MESSAGE_NEWER_PACKAGE_EXISTS, "A newer version of %s is available online." % po.name)
- def install_files(self,trusted,inst_files):
+ def install_files(self, trusted, inst_files):
'''
Implement the {backend}-install-files functionality
Install the package containing the inst_file file
@@ -1009,7 +1009,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
'''
for inst_file in inst_files:
if inst_file.endswith('.src.rpm'):
- self.error(ERROR_CANNOT_INSTALL_SOURCE_PACKAGE,'Backend will not install a src rpm file')
+ self.error(ERROR_CANNOT_INSTALL_SOURCE_PACKAGE, 'Backend will not install a src rpm file')
return
self._check_init()
@@ -1020,13 +1020,13 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
# check we have at least one file
if len(inst_files) == 0:
- self.error(ERROR_FILE_NOT_FOUND,'no files specified to install')
+ self.error(ERROR_FILE_NOT_FOUND, 'no files specified to install')
return
# check that the files still exist
for inst_file in inst_files:
if not os.path.exists(inst_file):
- self.error(ERROR_FILE_NOT_FOUND,'%s could not be found' % inst_file)
+ self.error(ERROR_FILE_NOT_FOUND, '%s could not be found' % inst_file)
return
# process these first
@@ -1039,16 +1039,16 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
elif inst_file.endswith('.servicepack'):
inst_packs.append(inst_file)
else:
- self.error(ERROR_INVALID_PACKAGE_FILE,'Only rpm files and packs are supported')
+ self.error(ERROR_INVALID_PACKAGE_FILE, 'Only rpm files and packs are supported')
return
# decompress and add the contents of any .servicepack files
for inst_pack in inst_packs:
inst_files.remove(inst_pack)
- pack = tarfile.TarFile(name = inst_pack,mode = "r")
+ pack = tarfile.TarFile(name = inst_pack, mode = "r")
members = pack.getnames()
for mem in members:
- pack.extract(mem,path = tempdir)
+ pack.extract(mem, path = tempdir)
files = os.listdir(tempdir)
for fn in files:
if fn.endswith('.rpm'):
@@ -1062,10 +1062,10 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
pkg = YumLocalPackage(ts=self.yumbase.rpmdb.readOnlyTS(), filename=inst_file)
if self._is_inst(pkg):
to_remove.append(inst_file)
- except yum.Errors.YumBaseError,e:
- self.error(ERROR_INVALID_PACKAGE_FILE,'Package could not be decompressed')
+ except yum.Errors.YumBaseError, e:
+ self.error(ERROR_INVALID_PACKAGE_FILE, 'Package could not be decompressed')
except:
- self.error(ERROR_UNKNOWN,"Failed to open local file -- please report")
+ self.error(ERROR_UNKNOWN, "Failed to open local file -- please report")
# Some fiddly code to get the messaging right
if len(inst_files) == 1 and len(to_remove) == 1:
@@ -1094,8 +1094,8 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
po = YumLocalPackage(ts=self.yumbase.rpmdb.readOnlyTS(), filename=inst_file)
try:
self.yumbase._checkSignatures([po], None)
- except yum.Errors.YumGPGCheckError,e:
- self.error(ERROR_MISSING_GPG_SIGNATURE,str(e))
+ except yum.Errors.YumGPGCheckError, e:
+ self.error(ERROR_MISSING_GPG_SIGNATURE, str(e))
else:
self.yumbase.conf.gpgcheck = 0
@@ -1113,14 +1113,14 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self._checkForNewer(txmbr[0].po)
# Added the package to the transaction set
else:
- self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s" % inst_file)
+ self.error(ERROR_LOCAL_INSTALL_FAILED, "Can't install %s" % inst_file)
if len(self.yumbase.tsInfo) == 0:
- self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s" % " or ".join(inst_files))
+ self.error(ERROR_LOCAL_INSTALL_FAILED, "Can't install %s" % " or ".join(inst_files))
self._runYumTransaction()
- except yum.Errors.InstallError,e:
- self.error(ERROR_LOCAL_INSTALL_FAILED,str(e))
- except (yum.Errors.RepoError,yum.Errors.PackageSackError,IOError):
+ except yum.Errors.InstallError, e:
+ self.error(ERROR_LOCAL_INSTALL_FAILED, str(e))
+ except (yum.Errors.RepoError, yum.Errors.PackageSackError, IOError):
# We might not be able to connect to the internet to get
# repository metadata, or the package might not exist.
# Try again, (temporarily) disabling repos first.
@@ -1137,9 +1137,9 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self.yumbase.tsInfo.pkgSack = MetaSack()
self._runYumTransaction()
else:
- self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s" % inst_file)
- except yum.Errors.InstallError,e:
- self.error(ERROR_LOCAL_INSTALL_FAILED,str(e))
+ self.error(ERROR_LOCAL_INSTALL_FAILED, "Can't install %s" % inst_file)
+ except yum.Errors.InstallError, e:
+ self.error(ERROR_LOCAL_INSTALL_FAILED, str(e))
shutil.rmtree(tempdir)
def _check_local_file(self, pkg):
@@ -1166,7 +1166,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
return True
- def update_packages(self,package_ids):
+ def update_packages(self, package_ids):
'''
Implement the {backend}-install functionality
This will only work with yum 3.2.4 or higher
@@ -1179,16 +1179,16 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
txmbrs = []
try:
for package in package_ids:
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
if pkg:
txmbr = self.yumbase.update(po=pkg)
txmbrs.extend(txmbr)
- except yum.Errors.RepoError,e:
- self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_REPO_NOT_AVAILABLE, str(e))
if txmbrs:
self._runYumTransaction()
else:
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"No available updates")
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED, "No available updates")
def _check_for_reboot(self):
md = self.updateMetadata
@@ -1196,46 +1196,46 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
pkg = txmbr.po
# check if package is in reboot list or flagged with reboot_suggested
# in the update metadata and is installed/updated etc
- notice = md.get_notice((pkg.name,pkg.version,pkg.release))
+ notice = md.get_notice((pkg.name, pkg.version, pkg.release))
if (pkg.name in self.rebootpkgs \
or (notice and notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']))\
and txmbr.ts_state in TS_INSTALL_STATES:
- self.require_restart(RESTART_SYSTEM,"")
+ self.require_restart(RESTART_SYSTEM, "")
break
- def _truncate(self, text,length,etc='...'):
+ def _truncate(self, text, length, etc='...'):
if len(text) < length:
return text
else:
return text[:length] + etc
- def _format_msgs(self,msgs):
- if isinstance(msgs,basestring):
+ def _format_msgs(self, msgs):
+ if isinstance(msgs, basestring):
msgs = msgs.split('\n')
text = ";".join(msgs)
text = self._truncate(text, 1024)
- text = text.replace(";Please report this error in bugzilla","")
- text = text.replace("Missing Dependency: ","")
- text = text.replace(" (installed)","")
+ text = text.replace(";Please report this error in bugzilla", "")
+ text = text.replace("Missing Dependency: ", "")
+ text = text.replace(" (installed)", "")
return text
- def _runYumTransaction(self,removedeps=None):
+ def _runYumTransaction(self, removedeps=None):
'''
Run the yum Transaction
This will only work with yum 3.2.4 or higher
'''
try:
- rc,msgs = self.yumbase.buildTransaction()
- except yum.Errors.RepoError,e:
- self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
+ rc, msgs = self.yumbase.buildTransaction()
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_REPO_NOT_AVAILABLE, str(e))
if rc != 2:
- self.error(ERROR_DEP_RESOLUTION_FAILED,self._format_msgs(msgs))
+ self.error(ERROR_DEP_RESOLUTION_FAILED, self._format_msgs(msgs))
else:
self._check_for_reboot()
if removedeps == False:
if len(self.yumbase.tsInfo) > 1:
retmsg = 'package could not be removed, as other packages depend on it'
- self.error(ERROR_DEP_RESOLUTION_FAILED,retmsg)
+ self.error(ERROR_DEP_RESOLUTION_FAILED, retmsg)
return
try:
@@ -1243,11 +1243,11 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
callback = ProcessTransPackageKitCallback(self)
self.yumbase.processTransaction(callback=callback,
rpmDisplay=rpmDisplay)
- except yum.Errors.YumDownloadError,ye:
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,self._format_msgs(ye.value))
- except yum.Errors.YumGPGCheckError,ye:
- self.error(ERROR_BAD_GPG_SIGNATURE,self._format_msgs(ye.value))
- except GPGKeyNotImported,e:
+ except yum.Errors.YumDownloadError, ye:
+ self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, self._format_msgs(ye.value))
+ except yum.Errors.YumGPGCheckError, ye:
+ self.error(ERROR_BAD_GPG_SIGNATURE, self._format_msgs(ye.value))
+ except GPGKeyNotImported, e:
keyData = self.yumbase.missingGPGKey
if not keyData:
self.error(ERROR_BAD_GPG_SIGNATURE,
@@ -1259,23 +1259,23 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self.repo_signature_required(package_id,
keyData['po'].repoid,
- keyData['keyurl'].replace("file://",""),
+ keyData['keyurl'].replace("file://", ""),
keyData['userid'],
keyData['hexkeyid'],
hex_fingerprint,
time.ctime(keyData['timestamp']),
'gpg')
- self.error(ERROR_GPG_FAILURE,"GPG key %s required" % keyData['hexkeyid'])
- except yum.Errors.YumBaseError,ye:
+ self.error(ERROR_GPG_FAILURE, "GPG key %s required" % keyData['hexkeyid'])
+ except yum.Errors.YumBaseError, ye:
message = self._format_msgs(ye.value)
if message.find ("conflicts with file") != -1:
- self.error(ERROR_FILE_CONFLICTS,message)
+ self.error(ERROR_FILE_CONFLICTS, message)
if message.find ("rpm_check_debug vs depsolve") != -1:
- self.error(ERROR_PACKAGE_CONFLICTS,message)
+ self.error(ERROR_PACKAGE_CONFLICTS, message)
else:
- self.error(ERROR_TRANSACTION_ERROR,message)
+ self.error(ERROR_TRANSACTION_ERROR, message)
- def remove_packages(self,allowdep,package_ids):
+ def remove_packages(self, allowdep, package_ids):
'''
Implement the {backend}-remove functionality
Needed to be implemented in a sub class
@@ -1291,32 +1291,32 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
grp = self._is_meta_package(package)
if grp:
if not grp.installed:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,"This Group %s is not installed" % grp.groupid)
+ self.error(ERROR_PACKAGE_NOT_INSTALLED, "This Group %s is not installed" % grp.groupid)
txmbr = self.yumbase.groupRemove(grp.groupid)
txmbrs.extend(txmbr)
else:
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
if pkg and inst:
txmbr = self.yumbase.remove(po=pkg)
txmbrs.extend(txmbr)
if pkg and not inst:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,"The package %s is not installed" % pkg.name)
+ self.error(ERROR_PACKAGE_NOT_INSTALLED, "The package %s is not installed" % pkg.name)
if txmbrs:
if allowdep != 'yes':
self._runYumTransaction(removedeps=False)
else:
self._runYumTransaction(removedeps=True)
else:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,"The packages failed to be removed")
+ self.error(ERROR_PACKAGE_NOT_INSTALLED, "The packages failed to be removed")
- def _get_category(self,groupid):
+ def _get_category(self, groupid):
cat_id = self.comps.get_category(groupid)
if self.yumbase.comps._categories.has_key(cat_id):
return self.yumbase.comps._categories[cat_id]
else:
return None
- def get_details(self,package_ids):
+ def get_details(self, package_ids):
'''
Print a detailed details for a given package
'''
@@ -1331,33 +1331,33 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
if grp:
package_id = "%s;;;meta" % grp.groupid
desc = grp.descriptionByLang(self._lang)
- desc = desc.replace('\n\n',';')
- desc = desc.replace('\n',' ')
+ desc = desc.replace('\n\n', ';')
+ desc = desc.replace('\n', ' ')
group = GROUP_COLLECTIONS
pkgs = self._get_group_packages(grp)
size = 0
for pkg in pkgs:
size = size + pkg.size
- self.details(package_id,"",group,desc,"",size)
+ self.details(package_id, "", group, desc, "", size)
else:
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
if pkg:
self._show_details_pkg(pkg)
else:
- self.error(ERROR_PACKAGE_NOT_FOUND,'Package %s was not found' % package)
+ self.error(ERROR_PACKAGE_NOT_FOUND, 'Package %s was not found' % package)
- def _show_details_pkg(self,pkg):
+ def _show_details_pkg(self, pkg):
pkgver = self._get_package_ver(pkg)
- package_id = self.get_package_id(pkg.name,pkgver,pkg.arch,pkg.repo)
+ package_id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
desc = pkg.description
- desc = desc.replace('\n\n',';')
- desc = desc.replace('\n',' ')
+ desc = desc.replace('\n\n', ';')
+ desc = desc.replace('\n', ' ')
group = self.comps.get_group(pkg.name)
- self.details(package_id,pkg.license,group,desc,pkg.url,pkg.size)
+ self.details(package_id, pkg.license, group, desc, pkg.url, pkg.size)
- def get_files(self,package_ids):
+ def get_files(self, package_ids):
self._check_init()
self.yumbase.conf.cache = 0 # Allow new files
self.allow_cancel(True)
@@ -1365,28 +1365,28 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self.status(STATUS_INFO)
for package in package_ids:
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
if pkg:
files = pkg.returnFileEntries('dir')
files.extend(pkg.returnFileEntries()) # regular files
file_list = ";".join(files)
- self.files(package,file_list)
+ self.files(package, file_list)
else:
- self.error(ERROR_PACKAGE_NOT_FOUND,'Package %s was not found' % package)
+ self.error(ERROR_PACKAGE_NOT_FOUND, 'Package %s was not found' % package)
- def _pkg_to_id(self,pkg):
+ def _pkg_to_id(self, pkg):
pkgver = self._get_package_ver(pkg)
- package_id = self.get_package_id(pkg.name,pkgver,pkg.arch,pkg.repo)
+ package_id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
return package_id
- def _show_package(self,pkg,status):
+ def _show_package(self, pkg, status):
''' Show info about package'''
package_id = self._pkg_to_id(pkg)
- self.package(package_id,status,pkg.summary)
+ self.package(package_id, status, pkg.summary)
- def _get_status(self,notice):
+ def _get_status(self, notice):
ut = notice['type']
if ut == 'security':
return INFO_SECURITY
@@ -1413,13 +1413,13 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
#install preupgrade
pkgs = self.yumbase.pkgSack.searchNevra(name='preupgrade')
if len(pkgs) == 0:
- self.error(ERROR_PACKAGE_NOT_FOUND,"Could not find upgrade preupgrade package in any enabled repos")
+ self.error(ERROR_PACKAGE_NOT_FOUND, "Could not find upgrade preupgrade package in any enabled repos")
elif len(pkgs) == 1:
txmbr = self.yumbase.install(po=pkgs[0])
if txmbr:
self._runYumTransaction()
else:
- self.error(ERROR_INTERNAL_ERROR,"not one update possibility")
+ self.error(ERROR_INTERNAL_ERROR, "not one update possibility")
elif len(pkgs) == 1:
# check if there are any updates to the preupgrade package
po = pkgs[0]
@@ -1432,7 +1432,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
if txmbr:
self._runYumTransaction()
else:
- self.error(ERROR_INTERNAL_ERROR,"more than one preupgrade package installed")
+ self.error(ERROR_INTERNAL_ERROR, "more than one preupgrade package installed")
# parse the releases file
config = ConfigParser.ConfigParser()
@@ -1443,15 +1443,15 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
last_version = 0
for section in config.sections():
# we only care about stable versions
- if config.has_option(section,'stable') and config.getboolean(section,'stable'):
- version = config.getfloat(section,'version')
+ if config.has_option(section, 'stable') and config.getboolean(section, 'stable'):
+ version = config.getfloat(section, 'version')
if (version > last_version):
newest = section
last_version = version
# got no valid data
if not newest:
- self.error(ERROR_FAILED_CONFIG_PARSING,"could not get latest distro data")
+ self.error(ERROR_FAILED_CONFIG_PARSING, "could not get latest distro data")
# are we already on the latest version
present_version = self.yumbase.conf.yumvar['releasever']
@@ -1460,10 +1460,10 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
# if we have an upgrade candidate then pass back data to daemon
tok = newest.split(" ")
- name = "%s-%s" % (tok[0].lower(),tok[1])
+ name = "%s-%s" % (tok[0].lower(), tok[1])
self.distro_upgrade(DISTRO_UPGRADE_STABLE, name, newest)
- def get_updates(self,filters):
+ def get_updates(self, filters):
'''
Implement the {backend}-get-updates functionality
@param filters: package types to show
@@ -1483,23 +1483,23 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
pkgs.extend(ygl.updates)
ygl = self.yumbase.doPackageLists(pkgnarrow='obsoletes')
pkgs.extend(ygl.obsoletes)
- except yum.Errors.RepoError,e:
- self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_REPO_NOT_AVAILABLE, str(e))
md = self.updateMetadata
for pkg in pkgs:
if pkgfilter._do_extra_filtering(pkg):
# Get info about package in updates info
- notice = md.get_notice((pkg.name,pkg.version,pkg.release))
+ notice = md.get_notice((pkg.name, pkg.version, pkg.release))
if notice:
status = self._get_status(notice)
- pkgfilter.add_custom(pkg,status)
+ pkgfilter.add_custom(pkg, status)
else:
- pkgfilter.add_custom(pkg,INFO_NORMAL)
+ pkgfilter.add_custom(pkg, INFO_NORMAL)
package_list = pkgfilter.post_process()
self._show_package_list(package_list)
- def repo_enable(self,repoid,enable):
+ def repo_enable(self, repoid, enable):
'''
Implement the {backend}-repo-enable functionality
'''
@@ -1515,10 +1515,10 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
if not repo.isEnabled():
repo.enablePersistent()
- except yum.Errors.RepoError,e:
- self.error(ERROR_REPO_NOT_FOUND,str(e))
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_REPO_NOT_FOUND, str(e))
- def _is_development_repo(self,repo):
+ def _is_development_repo(self, repo):
if repo.endswith('-debuginfo'):
return True
if repo.endswith('-testing'):
@@ -1531,7 +1531,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
return True
return False
- def get_repo_list(self,filters):
+ def get_repo_list(self, filters):
'''
Implement the {backend}-get-repo-list functionality
'''
@@ -1542,14 +1542,14 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
for repo in self.yumbase.repos.repos.values():
if filters != FILTER_NOT_DEVELOPMENT or not self._is_development_repo(repo.id):
if repo.isEnabled():
- self.repo_detail(repo.id,repo.name,'true')
+ self.repo_detail(repo.id, repo.name, 'true')
else:
- self.repo_detail(repo.id,repo.name,'false')
+ self.repo_detail(repo.id, repo.name, 'false')
- def _get_obsoleted(self,name):
+ def _get_obsoleted(self, name):
try:
obsoletes = self.yumbase.up.getObsoletesTuples(newest=1)
- for (obsoleting,installed) in obsoletes:
+ for (obsoleting, installed) in obsoletes:
if obsoleting[0] == name:
pkg = self.yumbase.rpmdb.searchPkgTuple(installed)[0]
return self._pkg_to_id(pkg)
@@ -1557,9 +1557,9 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
pass # no obsolete data - fd#17528
return ""
- def _get_updated(self,pkg):
+ def _get_updated(self, pkg):
updated = None
- pkgs = self.yumbase.rpmdb.searchNevra(name=pkg.name,arch=pkg.arch)
+ pkgs = self.yumbase.rpmdb.searchNevra(name=pkg.name, arch=pkg.arch)
if pkgs:
return self._pkg_to_id(pkgs[0])
else:
@@ -1578,7 +1578,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
_updateMetadata = None
updateMetadata = property(fget=_get_update_metadata)
- def _format_str(self,str):
+ def _format_str(self, str):
"""
Convert a multi line string to a list separated by ';'
"""
@@ -1588,7 +1588,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
else:
return ""
- def _format_list(self,lst):
+ def _format_list(self, lst):
"""
Convert a multi line string to a list separated by ';'
"""
@@ -1597,14 +1597,14 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
else:
return ""
- def _get_update_extras(self,pkg):
+ def _get_update_extras(self, pkg):
md = self.updateMetadata
- notice = md.get_notice((pkg.name,pkg.version,pkg.release))
- urls = {'bugzilla':[],'cve' : [],'vendor': []}
+ notice = md.get_notice((pkg.name, pkg.version, pkg.release))
+ urls = {'bugzilla':[], 'cve' : [], 'vendor': []}
if notice:
# Update Details
desc = notice['description']
- # Update References (Bugzilla,CVE ...)
+ # Update References (Bugzilla, CVE ...)
refs = notice['references']
if refs:
for ref in refs:
@@ -1613,19 +1613,19 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
title = ref['title'] or ""
# Description can sometimes have ';' in them, and we use that as the delimiter
- title = title.replace(";",",")
+ title = title.replace(";", ", ")
if href:
- if typ in ('bugzilla','cve'):
- urls[typ].append("%s;%s" % (href,title))
+ if typ in ('bugzilla', 'cve'):
+ urls[typ].append("%s;%s" % (href, title))
else:
- urls['vendor'].append("%s;%s" % (href,title))
+ urls['vendor'].append("%s;%s" % (href, title))
# add link to bohdi if available
if notice['update_id']:
href = "https://admin.fedoraproject.org/updates/%s" % notice['update_id']
- title = "%s Update %s" % (notice['release'],notice['update_id'])
- urls['vendor'].append("%s;%s" % (href,title))
+ title = "%s Update %s" % (notice['release'], notice['update_id'])
+ urls['vendor'].append("%s;%s" % (href, title))
# other interesting data:
changelog = ''
@@ -1638,11 +1638,11 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
reboot = 'system'
else:
reboot = 'none'
- return self._format_str(desc),urls,reboot,changelog,state,issued,updated
+ return self._format_str(desc), urls, reboot, changelog, state, issued, updated
else:
- return "",urls,"none",'','','',''
+ return "", urls, "none", '', '', '', ''
- def get_update_detail(self,package_ids):
+ def get_update_detail(self, package_ids):
'''
Implement the {backend}-get-update_detail functionality
'''
@@ -1652,16 +1652,16 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self.percentage(None)
self.status(STATUS_INFO)
for package in package_ids:
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
update = self._get_updated(pkg)
obsolete = self._get_obsoleted(pkg.name)
- desc,urls,reboot,changelog,state,issued,updated = self._get_update_extras(pkg)
+ desc, urls, reboot, changelog, state, issued, updated = self._get_update_extras(pkg)
cve_url = self._format_list(urls['cve'])
bz_url = self._format_list(urls['bugzilla'])
vendor_url = self._format_list(urls['vendor'])
- self.update_detail(package,update,obsolete,vendor_url,bz_url,cve_url,reboot,desc,changelog,state,issued,updated)
+ self.update_detail(package, update, obsolete, vendor_url, bz_url, cve_url, reboot, desc, changelog, state, issued, updated)
- def repo_set_data(self,repoid,parameter,value):
+ def repo_set_data(self, repoid, parameter, value):
'''
Implement the {backend}-repo-set-data functionality
'''
@@ -1670,30 +1670,30 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
# Get the repo
repo = self.yumbase.repos.getRepo(repoid)
if repo:
- repo.cfg.set(repoid,parameter,value)
+ repo.cfg.set(repoid, parameter, value)
try:
- repo.cfg.write(file(repo.repofile,'w'))
- except IOError,e:
- self.error(ERROR_CANNOT_WRITE_REPO_CONFIG,str(e))
+ repo.cfg.write(file(repo.repofile, 'w'))
+ except IOError, e:
+ self.error(ERROR_CANNOT_WRITE_REPO_CONFIG, str(e))
else:
- self.error(ERROR_REPO_NOT_FOUND,'repo %s not found' % repoid)
+ self.error(ERROR_REPO_NOT_FOUND, 'repo %s not found' % repoid)
- def install_signature(self,sigtype,key_id,package):
+ def install_signature(self, sigtype, key_id, package):
self._check_init()
self.yumbase.conf.cache = 0 # Allow new files
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
- pkg,inst = self._findPackage(package)
+ pkg, inst = self._findPackage(package)
if pkg:
try:
- self.yumbase.getKeyForPackage(pkg,askcb = lambda x,y,z: True)
- except yum.Errors.YumBaseError,e:
- self.error(ERROR_UNKNOWN,"cannot install signature: %s" % str(e))
+ self.yumbase.getKeyForPackage(pkg, askcb = lambda x, y, z: True)
+ except yum.Errors.YumBaseError, e:
+ self.error(ERROR_UNKNOWN, "cannot install signature: %s" % str(e))
except:
- self.error(ERROR_GPG_FAILURE,"Error importing GPG Key for %s" % pkg)
+ self.error(ERROR_GPG_FAILURE, "Error importing GPG Key for %s" % pkg)
- def _check_init(self,lazy_cache=False):
+ def _check_init(self, lazy_cache=False):
'''Just does the caching tweaks'''
if lazy_cache:
for repo in self.yumbase.repos.listEnabled():
@@ -1711,24 +1711,24 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
self.yumbase.repos.setCache(0)
try:
- self.yumbase.repos.populateSack(mdtype='metadata',cacheonly=1)
- self.yumbase.repos.populateSack(mdtype='filelists',cacheonly=1)
- self.yumbase.repos.populateSack(mdtype='otherdata',cacheonly=1)
- except yum.Errors.RepoError,e:
- self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
+ self.yumbase.repos.populateSack(mdtype='metadata', cacheonly=1)
+ self.yumbase.repos.populateSack(mdtype='filelists', cacheonly=1)
+ self.yumbase.repos.populateSack(mdtype='otherdata', cacheonly=1)
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_REPO_NOT_AVAILABLE, str(e))
self.yumbase.conf.cache = old_cache_setting
self.yumbase.repos.setCache(old_cache_setting)
def _setup_yum(self):
- self.yumbase._getConfig(errorlevel=-1,debuglevel=-1) # Setup Yum Config
+ self.yumbase._getConfig(errorlevel=-1, debuglevel=-1) # Setup Yum Config
self.yumbase.conf.throttle = "90%" # Set bandwidth throttle to 40%
- self.dnlCallback = DownloadCallback(self,showNames=True) # Download callback
+ self.dnlCallback = DownloadCallback(self, showNames=True) # Download callback
self.yumbase.repos.setProgressBar(self.dnlCallback) # Setup the download callback class
class DownloadCallback(BaseMeter):
""" Customized version of urlgrabber.progress.BaseMeter class """
- def __init__(self,base,showNames = False):
+ def __init__(self, base, showNames = False):
BaseMeter.__init__(self)
self.totSize = ""
self.base = base
@@ -1740,16 +1740,16 @@ class DownloadCallback(BaseMeter):
self.numPkgs = 0
self.bump = 0.0
- def setPackages(self,pkgs,startPct,numPct):
+ def setPackages(self, pkgs, startPct, numPct):
self.pkgs = pkgs
self.numPkgs = float(len(self.pkgs))
self.bump = numPct/self.numPkgs
self.totalPct = startPct
- def _getPackage(self,name):
+ def _getPackage(self, name):
if self.pkgs:
for pkg in self.pkgs:
- if isinstance(pkg,YumLocalPackage):
+ if isinstance(pkg, YumLocalPackage):
rpmfn = pkg.localPkg
else:
rpmfn = os.path.basename(pkg.remote_path) # get the rpm filename of the package
@@ -1757,16 +1757,16 @@ class DownloadCallback(BaseMeter):
return pkg
return None
- def update(self,amount_read,now=None):
- BaseMeter.update(self,amount_read,now)
+ def update(self, amount_read, now=None):
+ BaseMeter.update(self, amount_read, now)
- def _do_start(self,now=None):
+ def _do_start(self, now=None):
name = self._getName()
- self.updateProgress(name,0.0,"","")
+ self.updateProgress(name, 0.0, "", "")
if not self.size is None:
self.totSize = format_number(self.size)
- def _do_update(self,amount_read,now=None):
+ def _do_update(self, amount_read, now=None):
fread = format_number(amount_read)
name = self._getName()
if self.size is None:
@@ -1774,19 +1774,19 @@ class DownloadCallback(BaseMeter):
etime = self.re.elapsed_time()
fetime = format_time(etime)
frac = 0.0
- self.updateProgress(name,frac,fread,fetime)
+ self.updateProgress(name, frac, fread, fetime)
else:
# Remaining time
rtime = self.re.remaining_time()
frtime = format_time(rtime)
frac = self.re.fraction_read()
- self.updateProgress(name,frac,fread,frtime)
+ self.updateProgress(name, frac, fread, frtime)
- def _do_end(self,amount_read,now=None):
+ def _do_end(self, amount_read, now=None):
total_time = format_time(self.re.elapsed_time())
total_size = format_number(amount_read)
name = self._getName()
- self.updateProgress(name,1.0,total_size,total_time)
+ self.updateProgress(name, 1.0, total_size, total_time)
def _getName(self):
'''
@@ -1794,7 +1794,7 @@ class DownloadCallback(BaseMeter):
'''
return self.basename
- def updateProgress(self,name,frac,fread,ftime):
+ def updateProgress(self, name, frac, fread, ftime):
'''
Update the progressbar (Overload in child class)
@param name: filename
@@ -1814,7 +1814,7 @@ class DownloadCallback(BaseMeter):
if self.showNames:
pkg = self._getPackage(name)
if pkg: # show package to download
- self.base._show_package(pkg,INFO_DOWNLOADING)
+ self.base._show_package(pkg, INFO_DOWNLOADING)
else:
for key in MetaDataMap.keys():
if key in name:
@@ -1829,7 +1829,7 @@ class DownloadCallback(BaseMeter):
self.base.sub_percentage(pct)
class PackageKitCallback(RPMBaseCallback):
- def __init__(self,base):
+ def __init__(self, base):
RPMBaseCallback.__init__(self)
self.base = base
self.pct = 0
@@ -1859,49 +1859,49 @@ class PackageKitCallback(RPMBaseCallback):
TS_UPDATED: STATUS_CLEANUP,
TS_REPACKAGING: STATUS_REPACKAGING}
- def _calcTotalPct(self,ts_current,ts_total):
+ def _calcTotalPct(self, ts_current, ts_total):
bump = float(self.numPct)/ts_total
pct = int(self.startPct + (ts_current * bump))
return pct
- def _showName(self,status):
+ def _showName(self, status):
if type(self.curpkg) in types.StringTypes:
- package_id = self.base.get_package_id(self.curpkg,'','','')
+ package_id = self.base.get_package_id(self.curpkg, '', '', '')
else:
pkgver = self.base._get_package_ver(self.curpkg)
- package_id = self.base.get_package_id(self.curpkg.name,pkgver,self.curpkg.arch,self.curpkg.repo)
- self.base.package(package_id,status,"")
+ package_id = self.base.get_package_id(self.curpkg.name, pkgver, self.curpkg.arch, self.curpkg.repo)
+ self.base.package(package_id, status, "")
- def event(self,package,action,te_current,te_total,ts_current,ts_total):
+ def event(self, package, action, te_current, te_total, ts_current, ts_total):
if str(package) != str(self.curpkg):
self.curpkg = package
try:
self.base.status(self.state_actions[action])
self._showName(self.info_actions[action])
- except exceptions.KeyError,e:
- self.base.message(MESSAGE_BACKEND_ERROR,"The constant '%s' was unknown, please report" % action)
- pct = self._calcTotalPct(ts_current,ts_total)
+ except exceptions.KeyError, e:
+ self.base.message(MESSAGE_BACKEND_ERROR, "The constant '%s' was unknown, please report" % action)
+ pct = self._calcTotalPct(ts_current, ts_total)
self.base.percentage(pct)
val = (ts_current*100L)/ts_total
if val != self.pct:
self.pct = val
self.base.sub_percentage(val)
- def errorlog(self,msg):
+ def errorlog(self, msg):
# grrrrrrrr
pass
class ProcessTransPackageKitCallback:
- def __init__(self,base):
+ def __init__(self, base):
self.base = base
- def event(self,state,data=None):
+ def event(self, state, data=None):
if state == PT_DOWNLOAD: # Start Downloading
self.base.allow_cancel(True)
self.base.percentage(10)
self.base.status(STATUS_DOWNLOAD)
if state == PT_DOWNLOAD_PKGS: # Packages to download
- self.base.dnlCallback.setPackages(data,10,30)
+ self.base.dnlCallback.setPackages(data, 10, 30)
elif state == PT_GPGCHECK:
self.base.percentage(40)
self.base.status(STATUS_SIG_CHECK)
@@ -1920,7 +1920,7 @@ class DepSolveCallback(object):
# takes a PackageKitBackend so we can call StatusChanged on it.
# That's kind of hurky.
- def __init__(self,backend):
+ def __init__(self, backend):
self.started = False
self.backend = backend
@@ -1930,10 +1930,10 @@ class DepSolveCallback(object):
self.backend.percentage(None)
# Be lazy and not define the others explicitly
- def _do_nothing(self,*args,**kwargs):
+ def _do_nothing(self, *args, **kwargs):
pass
- def __getattr__(self,x):
+ def __getattr__(self, x):
return self._do_nothing
class PackageKitYumBase(yum.YumBase):
@@ -1942,34 +1942,34 @@ class PackageKitYumBase(yum.YumBase):
and nab the gpg sig data
"""
- def __init__(self,backend):
+ def __init__(self, backend):
yum.YumBase.__init__(self)
self.missingGPGKey = None
self.dsCallback = DepSolveCallback(backend)
- def _checkSignatures(self,pkgs,callback):
+ def _checkSignatures(self, pkgs, callback):
''' The the signatures of the downloaded packages '''
# This can be overloaded by a subclass.
for po in pkgs:
- result,errmsg = self.sigCheckPkg(po)
+ result, errmsg = self.sigCheckPkg(po)
if result == 0:
# verified ok, or verify not required
continue
elif result == 1:
# verify failed but installation of the correct GPG key might help
- self.getKeyForPackage(po,fullaskcb=self._fullAskForGPGKeyImport)
+ self.getKeyForPackage(po, fullaskcb=self._fullAskForGPGKeyImport)
else:
# fatal GPG verification error
- raise yum.Errors.YumGPGCheckError,errmsg
+ raise yum.Errors.YumGPGCheckError, errmsg
return 0
- def _fullAskForGPGKeyImport(self,data):
+ def _fullAskForGPGKeyImport(self, data):
self.missingGPGKey = data
raise GPGKeyNotImported()
- def _askForGPGKeyImport(self,po,userid,hexkeyid):
+ def _askForGPGKeyImport(self, po, userid, hexkeyid):
'''
Ask for GPGKeyImport
'''
@@ -1977,7 +1977,7 @@ class PackageKitYumBase(yum.YumBase):
return False
def main():
- backend = PackageKitYumBackend('',lock=True)
+ backend = PackageKitYumBackend('', lock=True)
backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
diff --git a/backends/yum/yumComps.py b/backends/yum/yumComps.py
index 7444dff..53e41f9 100755
--- a/backends/yum/yumComps.py
+++ b/backends/yum/yumComps.py
@@ -185,7 +185,7 @@ groupMap = {
class yumComps:
- def __init__(self,yumbase,db = None):
+ def __init__(self, yumbase, db = None):
self.yumbase = yumbase
self.cursor = None
self.connection = None
@@ -200,23 +200,23 @@ class yumComps:
self.connection = sqlite.connect(self.db)
self.cursor = self.connection.cursor()
except Exception, e:
- print 'cannot connect to database %s: %s' % (self.db,str(e))
+ print 'cannot connect to database %s: %s' % (self.db, str(e))
return False
# test if we can get a group for a common package, create if fail
try:
- self.cursor.execute('SELECT group_enum FROM groups WHERE name = ?;',['hal'])
+ self.cursor.execute('SELECT group_enum FROM groups WHERE name = ?;', ['hal'])
except Exception, e:
- self.cursor.execute('CREATE TABLE groups (name TEXT,category TEXT,groupid TEXT,group_enum TEXT,pkgtype Text);')
+ self.cursor.execute('CREATE TABLE groups (name TEXT, category TEXT, groupid TEXT, group_enum TEXT, pkgtype Text);')
self.refresh()
return True
- def _add_db(self,name,category,groupid,pkgroup,pkgtype):
+ def _add_db(self, name, category, groupid, pkgroup, pkgtype):
''' add an item into the database '''
- self.cursor.execute('INSERT INTO groups values(?,?,?,?,?);',(name,category,groupid,pkgroup,pkgtype))
+ self.cursor.execute('INSERT INTO groups values(?, ?, ?, ?, ?);', (name, category, groupid, pkgroup, pkgtype))
- def refresh(self,force=False):
+ def refresh(self, force=False):
''' get the data from yum (slow, REALLY SLOW) '''
cats = self.yumbase.comps.categories
@@ -229,43 +229,43 @@ class yumComps:
# store to sqlite
for category in cats:
grps = map(lambda x: self.yumbase.comps.return_group(x),
- filter(lambda x: self.yumbase.comps.has_group(x),category.groups))
+ filter(lambda x: self.yumbase.comps.has_group(x), category.groups))
for group in grps:
# strip out rpmfusion from the group name
group_name = group.groupid
- group_name = group_name.replace('rpmfusion_nonfree-','')
- group_name = group_name.replace('rpmfusion_free-','')
- group_id = "%s;%s" % (category.categoryid,group_name)
+ group_name = group_name.replace('rpmfusion_nonfree-', '')
+ group_name = group_name.replace('rpmfusion_free-', '')
+ group_id = "%s;%s" % (category.categoryid, group_name)
group_enum = GROUP_OTHER
if groupMap.has_key(group_id):
group_enum = groupMap[group_id]
else:
- print 'unknown group enum',group_id
+ print 'unknown group enum', group_id
for package in group.mandatory_packages:
- self._add_db(package,category.categoryid,group_name,group_enum,'mandatory')
+ self._add_db(package, category.categoryid, group_name, group_enum, 'mandatory')
for package in group.default_packages:
- self._add_db(package,category.categoryid,group_name,group_enum,'default')
+ self._add_db(package, category.categoryid, group_name, group_enum, 'default')
for package in group.optional_packages:
- self._add_db(package,category.categoryid,group_name,group_enum,'optional')
+ self._add_db(package, category.categoryid, group_name, group_enum, 'optional')
# write to disk
self.connection.commit()
return True
- def get_package_list(self,group_key):
+ def get_package_list(self, group_key):
''' for a PK group, get the packagelist for this group '''
all_packages = []
- self.cursor.execute('SELECT name FROM groups WHERE group_enum = ?;',[group_key])
+ self.cursor.execute('SELECT name FROM groups WHERE group_enum = ?;', [group_key])
for row in self.cursor:
all_packages.append(row[0])
return all_packages
- def get_group(self,pkgname):
+ def get_group(self, pkgname):
''' return the PackageKit group enum for the package '''
- self.cursor.execute('SELECT group_enum FROM groups WHERE name = ?;',[pkgname])
+ self.cursor.execute('SELECT group_enum FROM groups WHERE name = ?;', [pkgname])
group = GROUP_OTHER
for row in self.cursor:
group = row[0]
@@ -280,18 +280,18 @@ class yumComps:
metapkgs.add(row[0])
return list(metapkgs)
- def get_meta_package_list(self,groupid):
- ''' for a comps group, get the packagelist for this group (mandatory,default)'''
+ def get_meta_package_list(self, groupid):
+ ''' for a comps group, get the packagelist for this group (mandatory, default)'''
all_packages = []
- self.cursor.execute('SELECT name FROM groups WHERE groupid = ? AND ( pkgtype = "mandatory" OR pkgtype = "default");',[groupid])
+ self.cursor.execute('SELECT name FROM groups WHERE groupid = ? AND ( pkgtype = "mandatory" OR pkgtype = "default");', [groupid])
for row in self.cursor:
all_packages.append(row[0])
return all_packages
- def get_category(self,groupid):
+ def get_category(self, groupid):
''' for a comps group, get the category for a group '''
category = None
- self.cursor.execute('SELECT category FROM groups WHERE groupid = ?;',[groupid])
+ self.cursor.execute('SELECT category FROM groups WHERE groupid = ?;', [groupid])
for row in self.cursor:
category = row[0]
break
@@ -302,7 +302,7 @@ if __name__ == "__main__":
import os
yb = yum.YumBase()
db = "packagekit-groupsV2.sqlite"
- comps = yumComps(yb,db)
+ comps = yumComps(yb, db)
comps.connect()
comps.refresh()
print "pk group system"
diff --git a/backends/yum/yumFilter.py b/backends/yum/yumFilter.py
index 2236822..1888fd4 100644
--- a/backends/yum/yumFilter.py
+++ b/backends/yum/yumFilter.py
@@ -19,7 +19,7 @@
# Richard Hughes <richard at hughsie.com>
# imports
-from packagekit.backend import *
+from packagekit.enums import *
from packagekit.package import PackagekitPackage
import rpmUtils
@@ -27,35 +27,35 @@ import re
GUI_KEYS = re.compile(r'(qt)|(gtk)')
-class YumFilter(object,PackagekitPackage):
+class YumFilter(object, PackagekitPackage):
- def __init__(self,fltlist="none"):
+ def __init__(self, fltlist="none"):
''' connect to all enabled repos '''
self.fltlist = fltlist
self.package_list = [] #we can't do emitting as found if we are post-processing
self.installed_nevra = []
- def add_installed(self,pkgs):
+ def add_installed(self, pkgs):
''' add a list of packages that are already installed '''
for pkg in pkgs:
if self._do_extra_filtering(pkg):
- self.package_list.append((pkg,INFO_INSTALLED))
+ self.package_list.append((pkg, INFO_INSTALLED))
self.installed_nevra.append(self._get_nevra(pkg))
- def add_available(self,pkgs):
+ def add_available(self, pkgs):
# add a list of packages that are available
for pkg in pkgs:
nevra = self._get_nevra(pkg)
if nevra not in self.installed_nevra:
if self._do_extra_filtering(pkg):
- self.package_list.append((pkg,INFO_AVAILABLE))
+ self.package_list.append((pkg, INFO_AVAILABLE))
- def add_custom(self,pkg,info):
+ def add_custom(self, pkg, info):
''' add a custom packages indervidually '''
nevra = self._get_nevra(pkg)
if nevra not in self.installed_nevra:
if self._do_extra_filtering(pkg):
- self.package_list.append((pkg,info))
+ self.package_list.append((pkg, info))
def post_process(self):
''' do filtering we couldn't do when generating the list '''
@@ -68,11 +68,11 @@ class YumFilter(object,PackagekitPackage):
return self.package_list
- def _get_nevra(self,pkg):
+ def _get_nevra(self, pkg):
''' gets the NEVRA for a pkg '''
- return "%s-%s:%s-%s.%s" % (pkg.name,pkg.epoch,pkg.version,pkg.release,pkg.arch)
+ return "%s-%s:%s-%s.%s" % (pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch)
- def _is_main_package(self,repo):
+ def _is_main_package(self, repo):
if repo.endswith('-debuginfo'):
return False
if repo.endswith('-devel'):
@@ -81,7 +81,7 @@ class YumFilter(object,PackagekitPackage):
return False
return True
- def _basename_filter(self,package_list):
+ def _basename_filter(self, package_list):
'''
Filter the list so that the number of packages are reduced.
This is done by only displaying gtk2 rather than gtk2-devel, gtk2-debuginfo, etc.
@@ -89,7 +89,7 @@ class YumFilter(object,PackagekitPackage):
to the first entry.
We have to fall back else we don't emit packages where the SRPM does not produce a
RPM with the same name, for instance, mono produces mono-core, mono-data and mono-winforms.
- @package_list: a (pkg,status) list of packages
+ @package_list: a (pkg, status) list of packages
A new list is returned that has been filtered
'''
base_list = []
@@ -97,63 +97,63 @@ class YumFilter(object,PackagekitPackage):
base_list_already_got = []
#find out the srpm name and add to a new array of compound data
- for (pkg,status) in package_list:
+ for (pkg, status) in package_list:
if pkg.sourcerpm:
base = rpmUtils.miscutils.splitFilename(pkg.sourcerpm)[0]
- base_list.append ((pkg,status,base,pkg.version))
+ base_list.append ((pkg, status, base, pkg.version))
else:
- base_list.append ((pkg,status,'nosrpm',pkg.version))
+ base_list.append ((pkg, status, 'nosrpm', pkg.version))
#find all the packages that match thier basename name (done seporately so we get the "best" match)
- for (pkg,status,base,version) in base_list:
- if base == pkg.name and (base,version) not in base_list_already_got:
- output_list.append((pkg,status))
- base_list_already_got.append ((base,version))
+ for (pkg, status, base, version) in base_list:
+ if base == pkg.name and (base, version) not in base_list_already_got:
+ output_list.append((pkg, status))
+ base_list_already_got.append ((base, version))
#for all the ones not yet got, can we match against a non devel match?
- for (pkg,status,base,version) in base_list:
- if (base,version) not in base_list_already_got:
+ for (pkg, status, base, version) in base_list:
+ if (base, version) not in base_list_already_got:
if self._is_main_package(pkg.name):
- output_list.append((pkg,status))
- base_list_already_got.append ((base,version))
+ output_list.append((pkg, status))
+ base_list_already_got.append ((base, version))
#add the remainder of the packages, which should just be the single debuginfo's
- for (pkg,status,base,version) in base_list:
- if (base,version) not in base_list_already_got:
- output_list.append((pkg,status))
- base_list_already_got.append ((base,version))
+ for (pkg, status, base, version) in base_list:
+ if (base, version) not in base_list_already_got:
+ output_list.append((pkg, status))
+ base_list_already_got.append ((base, version))
return output_list
- def _do_newest_filtering(self,pkglist):
+ def _do_newest_filtering(self, pkglist):
'''
Only return the newest package for each name.arch
'''
newest = {}
- for pkg,state in pkglist:
+ for pkg, state in pkglist:
key = (pkg.name, pkg.arch)
if key in newest and pkg <= newest[key][0]:
continue
- newest[key] = (pkg,state)
+ newest[key] = (pkg, state)
return newest.values()
- def _do_extra_filtering(self,pkg):
- ''' do extra filtering (gui,devel etc) '''
- for filter in self.fltlist:
- if filter in (FILTER_INSTALLED,FILTER_NOT_INSTALLED):
- if not self._do_installed_filtering(filter,pkg):
+ def _do_extra_filtering(self, pkg):
+ ''' do extra filtering (gui, devel etc) '''
+ for flt in self.fltlist:
+ if flt in (FILTER_INSTALLED, FILTER_NOT_INSTALLED):
+ if not self._do_installed_filtering(flt, pkg):
return False
- elif filter in (FILTER_GUI,FILTER_NOT_GUI):
- if not self._do_gui_filtering(filter,pkg):
+ elif flt in (FILTER_GUI, FILTER_NOT_GUI):
+ if not self._do_gui_filtering(flt, pkg):
return False
- elif filter in (FILTER_DEVELOPMENT,FILTER_NOT_DEVELOPMENT):
- if not self._do_devel_filtering(filter,pkg):
+ elif flt in (FILTER_DEVELOPMENT, FILTER_NOT_DEVELOPMENT):
+ if not self._do_devel_filtering(flt, pkg):
return False
- elif filter in (FILTER_FREE,FILTER_NOT_FREE):
- if not self._do_free_filtering(filter,pkg):
+ elif flt in (FILTER_FREE, FILTER_NOT_FREE):
+ if not self._do_free_filtering(flt, pkg):
return False
return True
- def _do_installed_filtering(self,flt,pkg):
+ def _do_installed_filtering(self, flt, pkg):
is_installed = False
if flt == FILTER_INSTALLED:
want_installed = True
@@ -162,7 +162,7 @@ class YumFilter(object,PackagekitPackage):
is_installed = pkg.repo.id == 'installed'
return is_installed == want_installed
- def _do_gui_filtering(self,flt,pkg):
+ def _do_gui_filtering(self, flt, pkg):
is_gui = False
if flt == FILTER_GUI:
want_gui = True
@@ -171,7 +171,7 @@ class YumFilter(object,PackagekitPackage):
is_gui = self._check_for_gui(pkg)
return is_gui == want_gui
- def _check_for_gui(self,pkg):
+ def _check_for_gui(self, pkg):
''' Check if the GUI_KEYS regex matches any package requirements'''
for req in pkg.requires:
reqname = req[0]
@@ -179,7 +179,7 @@ class YumFilter(object,PackagekitPackage):
return True
return False
- def _do_devel_filtering(self,flt,pkg):
+ def _do_devel_filtering(self, flt, pkg):
is_devel = False
if flt == FILTER_DEVELOPMENT:
want_devel = True
@@ -190,7 +190,7 @@ class YumFilter(object,PackagekitPackage):
is_devel = True
return is_devel == want_devel
- def _do_free_filtering(self,flt,pkg):
+ def _do_free_filtering(self, flt, pkg):
is_free = False
if flt == FILTER_FREE:
want_free = True
More information about the PackageKit-commit
mailing list