~ubuntu-branches/ubuntu/lucid/landscape-client/lucid

« back to all changes in this revision

Viewing changes to landscape/reactor.py

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2009-12-16 10:50:05 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 27.
  • Revision ID: james.westby@ubuntu.com-20091216105005-bmki8i2of1dmcdkc
Tags: 1.4.0-0ubuntu0.9.10.0
* New upstream release (LP: #497351)

* Bug fixes:
  - Fix landscape daemons fail to start when too many groups are
    available (LP: #456124)
  - Fix landscape programs wake up far too much. (LP: #340843)
  - Fix Package manager fails with 'no such table: task' (LP #465846)
  - Fix test suite leaving temporary files around (LP #476418)
  - Fix the 1hr long wait for user data to be uploaded following a
    resynchronisation (LP #369000)

* Add support for Ubuntu release upgrades:
  - Add helper function to fetch many files at once (LP: #450629)
  - Handle release-upgrade messages in the packagemanager
    plugin (LP: #455217)
  - Add a release-upgrader task handler (LP: #462543)
  - Support upgrade-tool environment variables (LP: #463321)

* Add initial support for Smart package locking:
  - Detect and report changes about Smart package locks (#488108)

* Packaging fixes:
  - Turn unnecessary Pre-Depends on python-gobject into a regular Depends
  - If it's empty, remove /etc/landscape upon purge

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
from twisted.test.proto_helpers import FakeDatagramTransport
11
11
from twisted.internet.defer import succeed, fail
12
12
from twisted.internet.error import DNSLookupError
 
13
from twisted.internet.gtk2reactor import Gtk2Reactor
13
14
 
14
15
from landscape.log import format_object
15
16
 
435
436
 
436
437
        """
437
438
        return self._reactor.resolve(host)
 
439
 
 
440
 
 
441
class CustomGtk2Reactor(Gtk2Reactor):
 
442
    """
 
443
    This is a custom GTK reactor, but this ought to be a Glib reactor, but old
 
444
    versions of Twisted don't have such a class.
 
445
    """
 
446
 
 
447
    _simtag = None
 
448
 
 
449
    def simulate(self):
 
450
        """Run simulation loops and reschedule callbacks.
 
451
 
 
452
        This particular implementation differs from the L{Gtk2Reactor} one by
 
453
        having a much higher timeout, to wake up less.
 
454
        """
 
455
        if self._simtag is not None:
 
456
            gobject.source_remove(self._simtag)
 
457
        self.runUntilCurrent()
 
458
        timeout = min(self.timeout(), 1)
 
459
        if timeout is None:
 
460
            timeout = 1
 
461
        self._simtag = gobject.timeout_add(int(timeout * 1010), self.simulate)
 
462
 
 
463
 
 
464
def install():
 
465
    """Configure the Twisted mainloop to use our custom glib reactor."""
 
466
    reactor = CustomGtk2Reactor(useGtk=False)
 
467
    from twisted.internet.main import installReactor
 
468
    installReactor(reactor)