~mvo/software-center/fix-data-provider-i18n

« back to all changes in this revision

Viewing changes to softwarecenter/backend/channel_impl/aptchannels.py

  • Committer: Tarmac
  • Author(s): Rodney Dawes
  • Date: 2013-02-07 20:43:42 UTC
  • mfrom: (3290.2.2 bad-pygi-bad)
  • Revision ID: tarmac-20130207204342-e6ggsujgoord3zib
Check the pygobject version and use the right API signatures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Canonical
2
 
#
3
 
# Authors:
4
 
#  Gary Lasker
5
 
#  Michael Vogt
 
1
# Copyright (C) 2010-2013 Canonical Ltd.
6
2
#
7
3
# This program is free software; you can redistribute it and/or modify it under
8
4
# the terms of the GNU General Public License as published by the Free Software
16
12
# You should have received a copy of the GNU General Public License along with
17
13
# this program; if not, write to the Free Software Foundation, Inc.,
18
14
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
"""Software Center apt channels handling."""
19
16
 
20
17
import os
21
18
import logging
23
20
 
24
21
import softwarecenter.paths
25
22
 
 
23
from gi import version_info as gi_version
26
24
from gi.repository import GLib
27
25
 
28
26
from aptsources.sourceslist import SourceEntry, SourcesList
160
158
        (pid, stdin, stdout, stderr) = GLib.spawn_async(
161
159
            [channel_update],
162
160
            flags=GLib.SpawnFlags.DO_NOT_REAP_CHILD)
163
 
        GLib.child_watch_add(GLib.PRIORITY_DEFAULT,
164
 
            pid, self._on_check_for_channel_updates_finished)
 
161
        # python-gobject >= 3.7.3 has changed some API in incompatible
 
162
        # ways, so we need to check the version for which one to use.
 
163
        if gi_version < (3, 7, 3):
 
164
            GLib.child_watch_add(pid,
 
165
                                 self._on_check_for_channel_updates_finished)
 
166
        else:
 
167
            GLib.child_watch_add(GLib.PRIORITY_DEFAULT,
 
168
                                 pid,
 
169
                                 self._on_check_for_channel_updates_finished)
165
170
 
166
171
    def _on_check_for_channel_updates_finished(self, pid, condition):
167
172
        # exit status of 1 means stuff changed