~evfool/software-center/lp1076189

« back to all changes in this revision

Viewing changes to softwarecenter/backend/installbackend_impl/aptd.py

  • Committer: Michael Vogt
  • Date: 2012-12-17 08:51:40 UTC
  • mfrom: (3274.1.1 pep8-e125)
  • Revision ID: michael.vogt@ubuntu.com-20121217085140-1wkpd4sopmdw5iyo
mergedĀ lp:~mvo/software-center/pep8-e125

Show diffs side-by-side

added added

removed removed

Lines of Context:
285
285
    # FIXME: upgrade add-ons here
286
286
    @inline_callbacks
287
287
    def upgrade(self, app, iconname, addons_install=[], addons_remove=[],
288
 
        metadata=None):
 
288
                metadata=None):
289
289
        """ upgrade a single package """
290
290
        pkgname = app.pkgname
291
291
        appname = app.appname
328
328
 
329
329
    @inline_callbacks
330
330
    def remove(self, app, iconname, addons_install=[], addons_remove=[],
331
 
        metadata=None):
 
331
               metadata=None):
332
332
        """ remove a single package """
333
333
        pkgname = app.pkgname
334
334
        appname = app.appname
345
345
 
346
346
    @inline_callbacks
347
347
    def remove_multiple(self, apps, iconnames, addons_install=[],
348
 
        addons_remove=[], metadatas=None):
 
348
                        addons_remove=[], metadatas=None):
349
349
        """ queue a list of packages for removal  """
350
350
        if metadatas is None:
351
351
            metadatas = []
356
356
 
357
357
    @inline_callbacks
358
358
    def install(self, app, iconname, filename=None, addons_install=[],
359
 
        addons_remove=[], metadata=None, force=False):
 
359
                addons_remove=[], metadata=None, force=False):
360
360
        """Install a single package from the archive
361
361
           If filename is given a local deb package is installed instead.
362
362
        """
390
390
 
391
391
    @inline_callbacks
392
392
    def install_multiple(self, apps, iconnames, addons_install=[],
393
 
        addons_remove=[], metadatas=None):
 
393
                         addons_remove=[], metadatas=None):
394
394
        """ queue a list of packages for install  """
395
395
        if metadatas is None:
396
396
            metadatas = []
401
401
 
402
402
    @inline_callbacks
403
403
    def apply_changes(self, app, iconname, addons_install=[],
404
 
        addons_remove=[], metadata=None):
 
404
                      addons_remove=[], metadata=None):
405
405
        """ install and remove add-ons """
406
406
        pkgname = app.pkgname
407
407
        appname = app.appname
430
430
        d = apt_pkg.config.find_dir("Dir::Etc::sourceparts")
431
431
        trans = None
432
432
        if (not sources_list or
433
 
            not os.path.exists(os.path.join(d, sources_list))):
 
433
                not os.path.exists(os.path.join(d, sources_list))):
434
434
            sources_list = ""
435
435
        try:
436
436
            trans = yield self.aptd_client.update_cache(
480
480
 
481
481
    @inline_callbacks
482
482
    def add_vendor_key_from_keyserver(self, keyid,
483
 
        keyserver="hkp://keyserver.ubuntu.com:80/", metadata=None):
 
483
                                  keyserver="hkp://keyserver.ubuntu.com:80/",
 
484
                                  metadata=None):
484
485
        # strip the keysize
485
486
        if "/" in keyid:
486
487
            keyid = keyid.split("/")[1]
530
531
 
531
532
    @inline_callbacks
532
533
    def add_license_key(self, license_key, license_key_path,
533
 
        license_key_oauth, pkgname):
 
534
                        license_key_oauth, pkgname):
534
535
        """ add a license key for a purchase. """
535
536
        self._logger.debug(
536
537
            "adding license_key for pkg '%s' of len: %i" % (
630
631
 
631
632
    @inline_callbacks
632
633
    def _reload_for_commercial_repo_defer(self, app, trans_metadata,
633
 
        sources_list):
 
634
                                          sources_list):
634
635
        """
635
636
        helper that reloads and registers a callback for when the reload is
636
637
        finished
659
660
 
660
661
    @inline_callbacks
661
662
    def _on_reload_for_add_repo_and_install_app_finished(self, backend, trans,
662
 
        result, metadata, app):
 
663
                                                         result, metadata,
 
664
                                                         app):
663
665
        """
664
666
        callback that is called once after reload was queued
665
667
        and will trigger the install of the for-pay package itself
673
675
        # check if this is the transaction we waiting for
674
676
        key = "sc_add_repo_and_install_pkgname"
675
677
        if not (key in trans.meta_data and
676
 
            trans.meta_data[key] == app.pkgname):
 
678
                trans.meta_data[key] == app.pkgname):
677
679
            return_value(None)
678
680
 
679
681
        # get the debline and check if we have a release.gpg file
876
878
        if enum == enums.EXIT_FAILED:
877
879
            # Handle invalid packages separately
878
880
            if (trans.error and
879
 
                trans.error.code == enums.ERROR_INVALID_PACKAGE_FILE):
 
881
                    trans.error.code == enums.ERROR_INVALID_PACKAGE_FILE):
880
882
                action = _("_Ignore and install")
881
883
                res = self._show_transaction_failed_dialog(
882
884
                    trans, enum, action)