2013-10-16 10:34:09 -03:00
|
|
|
#! /usr/bin/python3
|
2013-03-31 14:31:33 -03:00
|
|
|
# -*- coding:utf-8 -*-
|
2013-03-18 07:07:58 -03:00
|
|
|
|
2013-11-26 05:24:54 -03:00
|
|
|
# pamac - A Python implementation of alpm
|
|
|
|
# Copyright (C) 2013 Guillaume Benoit <guillaume@manjaro.org>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2013-10-16 10:34:09 -03:00
|
|
|
from gi.repository import GObject
|
|
|
|
from pamac import common, transaction
|
|
|
|
import dbus
|
|
|
|
|
2013-11-15 10:37:12 -03:00
|
|
|
|
|
|
|
def handle_reply(reply):
|
2013-10-16 10:34:09 -03:00
|
|
|
print('check updates done')
|
2013-11-15 10:37:12 -03:00
|
|
|
transaction.CheckUpdates()
|
2013-10-16 10:34:09 -03:00
|
|
|
|
2013-11-15 10:37:12 -03:00
|
|
|
def handle_error(error):
|
2013-10-16 10:34:09 -03:00
|
|
|
transaction.StopDaemon()
|
|
|
|
print('check updates failed')
|
|
|
|
loop.quit()
|
|
|
|
|
2013-11-15 10:37:12 -03:00
|
|
|
def handle_updates(updates):
|
|
|
|
transaction.StopDaemon()
|
|
|
|
loop.quit()
|
|
|
|
|
2013-10-16 10:34:09 -03:00
|
|
|
loop = GObject.MainLoop()
|
2013-03-18 07:07:58 -03:00
|
|
|
|
|
|
|
if not common.pid_file_exists():
|
2013-10-16 10:34:09 -03:00
|
|
|
print('checking updates')
|
|
|
|
bus = dbus.SystemBus()
|
2013-11-15 10:37:12 -03:00
|
|
|
bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone")
|
|
|
|
bus.add_signal_receiver(handle_error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError")
|
|
|
|
bus.add_signal_receiver(handle_updates, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
|
2013-10-16 10:34:09 -03:00
|
|
|
transaction.get_dbus_methods()
|
|
|
|
try:
|
|
|
|
transaction.Refresh(False)
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
loop.run()
|