=== modified file 'debian/control' --- debian/control 2016-03-09 21:23:21 +0000 +++ debian/control 2016-03-12 23:42:38 +0000 @@ -9,7 +9,7 @@ | gnutls-dev (>= 3.3.0), xsltproc, pkg-config, libnl-route-3-dev Build-Depends-Indep: systemd, python (>= 2.7), python (<< 3), - python-dbus, python-gi | python-gobject + python-dbus, python-gi Standards-Version: 3.9.7 Vcs-Bzr: http://ftp.recompile.se/pub/mandos/trunk Vcs-Browser: http://bzr.recompile.se/loggerhead/mandos/trunk/files @@ -19,8 +19,8 @@ Architecture: all Depends: ${misc:Depends}, python (>= 2.7), python (<< 3), libgnutls28-dev (>= 3.3.0) | libgnutls30 (>= 3.3.0), - python-dbus, python-gi | python-gobject, - avahi-daemon, adduser, python-urwid, gnupg + python-dbus, python-gi, avahi-daemon, adduser, python-urwid, + gnupg Recommends: ssh-client | fping Description: server giving encrypted passwords to Mandos clients This is the server part of the Mandos system, which allows === modified file 'mandos' --- mandos 2016-03-12 20:23:15 +0000 +++ mandos 2016-03-12 23:42:38 +0000 @@ -79,10 +79,7 @@ import dbus import dbus.service -try: - from gi.repository import GObject -except ImportError: - import gobject as GObject +from gi.repository import GLib from dbus.mainloop.glib import DBusGMainLoop import ctypes import ctypes.util @@ -757,17 +754,17 @@ checker: subprocess.Popen(); a running checker process used to see if the client lives. 'None' if no process is running. - checker_callback_tag: a GObject event source tag, or None + checker_callback_tag: a GLib event source tag, or None checker_command: string; External command which is run to check if client lives. %() expansions are done at runtime with vars(self) as dict, so that for instance %(name)s can be used in the command. - checker_initiator_tag: a GObject event source tag, or None + checker_initiator_tag: a GLib event source tag, or None created: datetime.datetime(); (UTC) object creation client_structure: Object describing what attributes a client has and is used for storing the client at exit current_checker_command: string; current running checker_command - disable_initiator_tag: a GObject event source tag, or None + disable_initiator_tag: a GLib event source tag, or None enabled: bool() fingerprint: string (40 or 32 hexadecimal digits); used to uniquely identify the client @@ -929,17 +926,17 @@ if not quiet: logger.info("Disabling client %s", self.name) if getattr(self, "disable_initiator_tag", None) is not None: - GObject.source_remove(self.disable_initiator_tag) + GLib.source_remove(self.disable_initiator_tag) self.disable_initiator_tag = None self.expires = None if getattr(self, "checker_initiator_tag", None) is not None: - GObject.source_remove(self.checker_initiator_tag) + GLib.source_remove(self.checker_initiator_tag) self.checker_initiator_tag = None self.stop_checker() self.enabled = False if not quiet: self.send_changedstate() - # Do not run this again if called by a GObject.timeout_add + # Do not run this again if called by a GLib.timeout_add return False def __del__(self): @@ -949,14 +946,14 @@ # Schedule a new checker to be started an 'interval' from now, # and every interval from then on. if self.checker_initiator_tag is not None: - GObject.source_remove(self.checker_initiator_tag) - self.checker_initiator_tag = GObject.timeout_add( + GLib.source_remove(self.checker_initiator_tag) + self.checker_initiator_tag = GLib.timeout_add( int(self.interval.total_seconds() * 1000), self.start_checker) # Schedule a disable() when 'timeout' has passed if self.disable_initiator_tag is not None: - GObject.source_remove(self.disable_initiator_tag) - self.disable_initiator_tag = GObject.timeout_add( + GLib.source_remove(self.disable_initiator_tag) + self.disable_initiator_tag = GLib.timeout_add( int(self.timeout.total_seconds() * 1000), self.disable) # Also start a new checker *right now*. self.start_checker() @@ -998,10 +995,10 @@ if timeout is None: timeout = self.timeout if self.disable_initiator_tag is not None: - GObject.source_remove(self.disable_initiator_tag) + GLib.source_remove(self.disable_initiator_tag) self.disable_initiator_tag = None if getattr(self, "enabled", False): - self.disable_initiator_tag = GObject.timeout_add( + self.disable_initiator_tag = GLib.timeout_add( int(timeout.total_seconds() * 1000), self.disable) self.expires = datetime.datetime.utcnow() + timeout @@ -1062,16 +1059,16 @@ args = (pipe[1], subprocess.call, command), kwargs = popen_args) self.checker.start() - self.checker_callback_tag = GObject.io_add_watch( - pipe[0].fileno(), GObject.IO_IN, + self.checker_callback_tag = GLib.io_add_watch( + pipe[0].fileno(), GLib.IO_IN, self.checker_callback, pipe[0], command) - # Re-run this periodically if run by GObject.timeout_add + # Re-run this periodically if run by GLib.timeout_add return True def stop_checker(self): """Force the checker process, if any, to stop.""" if self.checker_callback_tag: - GObject.source_remove(self.checker_callback_tag) + GLib.source_remove(self.checker_callback_tag) self.checker_callback_tag = None if getattr(self, "checker", None) is None: return @@ -1832,8 +1829,8 @@ def approve(self, value=True): self.approved = value - GObject.timeout_add(int(self.approval_duration.total_seconds() - * 1000), self._reset_approved) + GLib.timeout_add(int(self.approval_duration.total_seconds() + * 1000), self._reset_approved) self.send_changedstate() ## D-Bus methods, signals & properties @@ -2049,8 +2046,8 @@ if (getattr(self, "disable_initiator_tag", None) is None): return - GObject.source_remove(self.disable_initiator_tag) - self.disable_initiator_tag = GObject.timeout_add( + GLib.source_remove(self.disable_initiator_tag) + self.disable_initiator_tag = GLib.timeout_add( int((self.expires - now).total_seconds() * 1000), self.disable) @@ -2076,8 +2073,8 @@ return if self.enabled: # Reschedule checker run - GObject.source_remove(self.checker_initiator_tag) - self.checker_initiator_tag = GObject.timeout_add( + GLib.source_remove(self.checker_initiator_tag) + self.checker_initiator_tag = GLib.timeout_add( value, self.start_checker) self.start_checker() # Start one now, too @@ -2487,7 +2484,7 @@ gnutls_priority GnuTLS priority string use_dbus: Boolean; to emit D-Bus signals or not - Assumes a GObject.MainLoop event loop. + Assumes a GLib.MainLoop event loop. """ def __init__(self, server_address, RequestHandlerClass, @@ -2518,9 +2515,9 @@ def add_pipe(self, parent_pipe, proc): # Call "handle_ipc" for both data and EOF events - GObject.io_add_watch( + GLib.io_add_watch( parent_pipe.fileno(), - GObject.IO_IN | GObject.IO_HUP, + GLib.IO_IN | GLib.IO_HUP, functools.partial(self.handle_ipc, parent_pipe = parent_pipe, proc = proc)) @@ -2530,7 +2527,7 @@ proc = None, client_object=None): # error, or the other end of multiprocessing.Pipe has closed - if condition & (GObject.IO_ERR | GObject.IO_HUP): + if condition & (GLib.IO_ERR | GLib.IO_HUP): # Wait for other process to exit proc.join() return False @@ -2557,9 +2554,9 @@ parent_pipe.send(False) return False - GObject.io_add_watch( + GLib.io_add_watch( parent_pipe.fileno(), - GObject.IO_IN | GObject.IO_HUP, + GLib.IO_IN | GLib.IO_HUP, functools.partial(self.handle_ipc, parent_pipe = parent_pipe, proc = proc, @@ -2995,14 +2992,14 @@ # Close all input and output, do double fork, etc. daemon() - # multiprocessing will use threads, so before we use GObject we - # need to inform GObject that threads will be used. - GObject.threads_init() + # multiprocessing will use threads, so before we use GLib we need + # to inform GLib that threads will be used. + GLib.threads_init() global main_loop # From the Avahi example code DBusGMainLoop(set_as_default=True) - main_loop = GObject.MainLoop() + main_loop = GLib.MainLoop() bus = dbus.SystemBus() # End of Avahi example code if use_dbus: @@ -3421,10 +3418,10 @@ sys.exit(1) # End of Avahi example code - GObject.io_add_watch(tcp_server.fileno(), GObject.IO_IN, - lambda *args, **kwargs: - (tcp_server.handle_request - (*args[2:], **kwargs) or True)) + GLib.io_add_watch(tcp_server.fileno(), GLib.IO_IN, + lambda *args, **kwargs: + (tcp_server.handle_request + (*args[2:], **kwargs) or True)) logger.debug("Starting main loop") main_loop.run() === modified file 'mandos-monitor' --- mandos-monitor 2016-03-08 00:14:50 +0000 +++ mandos-monitor 2016-03-12 23:42:38 +0000 @@ -39,10 +39,7 @@ import urwid from dbus.mainloop.glib import DBusGMainLoop -try: - from gi.repository import GObject -except ImportError: - import gobject as GObject +from gi.repository import GLib import dbus @@ -172,11 +169,11 @@ """ if flag and self._update_timer_callback_tag is None: # Will update the shown timer value every second - self._update_timer_callback_tag = (GObject.timeout_add + self._update_timer_callback_tag = (GLib.timeout_add (1000, self.update_timer)) elif not (flag or self._update_timer_callback_tag is None): - GObject.source_remove(self._update_timer_callback_tag) + GLib.source_remove(self._update_timer_callback_tag) self._update_timer_callback_tag = None def checker_completed(self, exitstatus, condition, command): @@ -309,14 +306,15 @@ self.update_hook() def update_timer(self): - """called by GObject. Will indefinitely loop until - GObject.source_remove() on tag is called""" + """called by GLib. Will indefinitely loop until + GLib.source_remove() on tag is called + """ self.update() return True # Keep calling this def delete(self, **kwargs): if self._update_timer_callback_tag is not None: - GObject.source_remove(self._update_timer_callback_tag) + GLib.source_remove(self._update_timer_callback_tag) self._update_timer_callback_tag = None for match in self.match_objects: match.remove() @@ -465,7 +463,7 @@ "q: Quit ?: Help")) self.busname = domain + '.Mandos' - self.main_loop = GObject.MainLoop() + self.main_loop = GLib.MainLoop() def client_not_found(self, fingerprint, address): self.log_message("Client with address {} and fingerprint {}" @@ -640,13 +638,13 @@ path=path) self.refresh() - self._input_callback_tag = (GObject.io_add_watch + self._input_callback_tag = (GLib.io_add_watch (sys.stdin.fileno(), - GObject.IO_IN, + GLib.IO_IN, self.process_input)) self.main_loop.run() # Main loop has finished, we should close everything now - GObject.source_remove(self._input_callback_tag) + GLib.source_remove(self._input_callback_tag) self.screen.stop() def stop(self):