Merge lp:~dobey/ubuntuone-client/gi-support into lp:ubuntuone-client

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 1193
Merged at revision: 1186
Proposed branch: lp:~dobey/ubuntuone-client/gi-support
Merge into: lp:ubuntuone-client
Diff against target: 505 lines (+113/-154)
14 files modified
Makefile.am (+2/-2)
bin/u1sdtool (+6/-2)
bin/ubuntuone-syncdaemon (+6/-2)
contrib/dbus-docs (+5/-2)
contrib/login_email_password.py (+6/-2)
tests/platform/linux/eventlog/test_zg_listener.py (+1/-1)
tests/platform/linux/test_messaging.py (+8/-4)
tests/platform/linux/test_notification.py (+16/-17)
tests/platform/linux/test_os_helper.py (+15/-4)
tests/status/test_aggregator.py (+2/-0)
ubuntuone/platform/linux/messaging.py (+42/-37)
ubuntuone/platform/linux/notification.py (+3/-1)
ubuntuone/platform/linux/os_helper.py (+1/-1)
ubuntuone/syncdaemon/sdreactor.py (+0/-79)
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/gi-support
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+90227@code.launchpad.net

Commit message

Remove the old, broken, and unused sdreactor code
Try the new gireactor first, and fall back to the old glib2reactor, when running scripts
Update code and tests to work correctly under either glib2reactor or gireactor

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Branch looks good!

A couple of improvements:

- Can you please move the patching of the indicate and pynotify modules to the setUp method?
- There are two test names that have changed and now start with an x... is that a typo? If not, and you want to skip those, please remove the x and add a test_all_together_now.skip = <some reason> to be explicit.

Thanks!

review: Needs Fixing
Revision history for this message
dobey (dobey) wrote :

Fixed now. The test_messaging code already had the indicate patching done inside of a utility method which the tests call that need it. I moved the mock_notify to setUp as well, and skipped the HundredFeetTestCase, with a bug reference.

Revision history for this message
Roberto Alsina (ralsina) wrote :

+1 (code review)

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (32.8 KiB)

The attempt to merge lp:~dobey/ubuntuone-client/gi-support into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.67
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
  testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.25
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.17
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recogni...

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (28.9 KiB)

The attempt to merge lp:~dobey/ubuntuone-client/gi-support into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.68
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.4.2
checking for intltool >= 0.30...
  testing intltoolize... found 0.50.0
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.26
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.18
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i686-pc-linux-gnu file names to i686-pc-linux-gnu for...

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (237.3 KiB)

The attempt to merge lp:~dobey/ubuntuone-client/gi-support into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.68
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.4.2
checking for intltool >= 0.30...
  testing intltoolize... found 0.50.0
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.26
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.18
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i686-pc-linux-gnu file names to i686-pc-linux-gnu for...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2011-11-23 15:51:03 +0000
3+++ Makefile.am 2012-01-26 19:33:54 +0000
4@@ -53,13 +53,13 @@
5 test: logging.conf $(clientdefs_DATA) Makefile
6 echo "$(PYTHONPATH)"
7 if test "x$(builddir)" == "x$(srcdir)"; then \
8- PYTHONPATH="$(PYTHONPATH)" u1trial -p tests/platform/windows tests; \
9+ PYTHONPATH="$(PYTHONPATH)" u1trial -r gi -p tests/platform/windows tests; \
10 fi
11 rm -rf _trial_temp
12
13 test-coverage: logging.conf $(clientdefs_DATA) Makefile
14 if test "x$(builddir)" == "x$(srcdir)"; then \
15- PYTHONPATH="$(PYTHONPATH)" u1trial -c tests; \
16+ PYTHONPATH="$(PYTHONPATH)" u1trial -r gi -c -p tests/platform/windows tests; \
17 fi
18 rm -rf _trial_temp
19
20
21=== modified file 'bin/u1sdtool'
22--- bin/u1sdtool 2012-01-03 12:52:20 +0000
23+++ bin/u1sdtool 2012-01-26 19:33:54 +0000
24@@ -19,8 +19,12 @@
25 import sys
26
27 if sys.platform != 'win32':
28- from twisted.internet import glib2reactor
29- glib2reactor.install()
30+ try:
31+ from twisted.internet import gireactor
32+ gireactor.install()
33+ except ImportError:
34+ from twisted.internet import glib2reactor
35+ glib2reactor.install()
36
37 import dbus
38 from dbus.mainloop.glib import DBusGMainLoop
39
40=== modified file 'bin/ubuntuone-syncdaemon'
41--- bin/ubuntuone-syncdaemon 2012-01-12 17:24:32 +0000
42+++ bin/ubuntuone-syncdaemon 2012-01-26 19:33:54 +0000
43@@ -19,8 +19,12 @@
44 import sys
45
46 if sys.platform != 'win32':
47- from twisted.internet import glib2reactor
48- glib2reactor.install()
49+ try:
50+ from twisted.internet import gireactor
51+ gireactor.install
52+ except ImportError:
53+ from twisted.internet import glib2reactor
54+ glib2reactor.install()
55
56 from dbus.mainloop.glib import DBusGMainLoop
57 DBusGMainLoop(set_as_default=True)
58
59=== modified file 'contrib/dbus-docs'
60--- contrib/dbus-docs 2012-01-03 12:52:20 +0000
61+++ contrib/dbus-docs 2012-01-26 19:33:54 +0000
62@@ -16,8 +16,11 @@
63 # You should have received a copy of the GNU General Public License along
64 # with this program. If not, see <http://www.gnu.org/licenses/>.
65
66-from twisted.internet import glib2reactor
67-glib2reactor.install()
68+try:
69+ from twisted.internet import gireactor as greactor
70+except ImportError:
71+ from twisted.internet import glib2reactor as greactor
72+greactor.install()
73
74 import sys
75 import os
76
77=== modified file 'contrib/login_email_password.py'
78--- contrib/login_email_password.py 2012-01-03 12:52:20 +0000
79+++ contrib/login_email_password.py 2012-01-26 19:33:54 +0000
80@@ -19,8 +19,12 @@
81 import sys
82
83 if sys.platform != 'win32':
84- from twisted.internet import glib2reactor
85- glib2reactor.install()
86+ try:
87+ from twisted.internet import gireactor
88+ gireactor.install()
89+ except ImportError:
90+ from twisted.internet import glib2reactor
91+ glib2reactor.install()
92
93 # pylint: disable=F0401, E1101
94 from twisted.internet import reactor
95
96=== modified file 'tests/platform/linux/eventlog/test_zg_listener.py'
97--- tests/platform/linux/eventlog/test_zg_listener.py 2012-01-17 20:00:44 +0000
98+++ tests/platform/linux/eventlog/test_zg_listener.py 2012-01-26 19:33:54 +0000
99@@ -512,7 +512,7 @@
100 self.assertEqual(folder.manifestation,
101 Manifestation.FILE_DATA_OBJECT)
102 self.assertTrue(folder.origin.startswith(URI_PROTOCOL_U1))
103- self.assertEqual(folder.text, folder_name)
104+ self.assertEqual(folder.text.decode('utf-8'), folder_name)
105 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
106 self.assertEqual(folder.storage, STORAGE_LOCAL)
107
108
109=== modified file 'tests/platform/linux/test_messaging.py'
110--- tests/platform/linux/test_messaging.py 2011-10-27 11:39:43 +0000
111+++ tests/platform/linux/test_messaging.py 2012-01-26 19:33:54 +0000
112@@ -20,7 +20,7 @@
113 least they ensure 100% coverage and hence no silly/syntax errors.
114
115 """
116-
117+import sys
118
119 from mocker import Mocker, ANY
120 from twisted.internet import defer
121@@ -58,14 +58,18 @@
122 def _show_message_setup(self, message_time=None, message_count=None,
123 icon=None, update_count=None, real_callback=False):
124 """Set up the mocker expectations for show_method."""
125- indicate = self.mocker.replace("indicate")
126 mock_server = self.mocker.mock()
127- indicate.indicate_server_ref_default()
128+ if 'gobject' in sys.modules and sys.modules['gobject'] is not None:
129+ indicate = self.mocker.replace("indicate")
130+ indicate.indicate_server_ref_default()
131+ else:
132+ indicate = self.mocker.replace('gi.repository.Indicate')
133+ indicate.Server.ref_default()
134 self.mocker.result(mock_server)
135 mock_server.connect('server-display', _server_callback)
136 mock_server.set_type("message.u1")
137 mock_server.set_desktop_file(
138- "/usr/share/applications/ubuntuone-control-panel-gtk.desktop")
139+ "/usr/share/applications/ubuntuone-installer.desktop")
140 mock_server.show()
141 mock_indicator = self.mocker.mock()
142 indicate.Indicator()
143
144=== modified file 'tests/platform/linux/test_notification.py'
145--- tests/platform/linux/test_notification.py 2012-01-25 15:37:38 +0000
146+++ tests/platform/linux/test_notification.py 2012-01-26 19:33:54 +0000
147@@ -20,7 +20,7 @@
148 least they ensure 100% coverage and hence no silly/syntax errors.
149
150 """
151-
152+import sys
153
154 from mocker import Mocker
155 from twisted.internet import defer
156@@ -57,11 +57,20 @@
157 self.mocker.restore()
158 self.mocker.verify()
159
160+ def _set_up_mock_notify(self, title, message, icon):
161+ """Set up the mock_notify expectations."""
162+ if 'gobject' in sys.modules and sys.modules['gobject'] is not None:
163+ mock_notify = self.mocker.replace("pynotify")
164+ mock_notify.init(FAKE_APP_NAME)
165+ mock_notify.Notification(title, message, icon)
166+ else:
167+ mock_notify = self.mocker.replace('gi.repository.Notify')
168+ mock_notify.init(FAKE_APP_NAME)
169+ mock_notify.Notification.new(title, message, icon)
170+
171 def test_send_notification(self):
172 """On notification, pynotify receives the proper calls."""
173- mock_notify = self.mocker.replace("pynotify")
174- mock_notify.init(FAKE_APP_NAME)
175- mock_notify.Notification(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
176+ self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
177 mock_notification = self.mocker.mock()
178 self.mocker.result(mock_notification)
179 mock_notification.show()
180@@ -70,9 +79,7 @@
181
182 def test_send_two_notifications(self):
183 """On notification, pynotify receives the proper calls."""
184- mock_notify = self.mocker.replace("pynotify")
185- mock_notify.init(FAKE_APP_NAME)
186- mock_notify.Notification(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
187+ self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
188 mock_notification = self.mocker.mock()
189 self.mocker.result(mock_notification)
190 mock_notification.show()
191@@ -86,9 +93,7 @@
192
193 def test_send_notification_with_icon(self):
194 """On notification with icon, pynotify receives the proper calls."""
195- mock_notify = self.mocker.replace("pynotify")
196- mock_notify.init(FAKE_APP_NAME)
197- mock_notify.Notification(FAKE_TITLE, FAKE_MESSAGE, FAKE_ICON)
198+ self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, FAKE_ICON)
199 mock_notification = self.mocker.mock()
200 self.mocker.result(mock_notification)
201 mock_notification.show()
202@@ -98,9 +103,7 @@
203
204 def test_append_notification(self):
205 """On notification append, pynotify receives the proper calls."""
206- mock_notify = self.mocker.replace("pynotify")
207- mock_notify.init(FAKE_APP_NAME)
208- mock_notify.Notification(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
209+ self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
210 mock_notification = self.mocker.mock()
211 self.mocker.result(mock_notification)
212 mock_notification.set_hint_string('x-canonical-append', '')
213@@ -112,7 +115,3 @@
214 notifier = Notification(FAKE_APP_NAME)
215 notifier.send_notification(FAKE_TITLE, FAKE_MESSAGE, append=True)
216 notifier.send_notification(FAKE_TITLE, FAKE_APPENDAGE, append=True)
217-
218-
219-NotificationTestCase.skip = "Not working when the GI Notify module is used " \
220-"(LP: #921574)."
221
222=== modified file 'tests/platform/linux/test_os_helper.py'
223--- tests/platform/linux/test_os_helper.py 2011-08-15 20:29:25 +0000
224+++ tests/platform/linux/test_os_helper.py 2012-01-26 19:33:54 +0000
225@@ -20,8 +20,14 @@
226
227 import logging
228 import os
229+import sys
230
231-import gio
232+if 'gobject' in sys.modules and sys.modules['gobject'] is not None:
233+ import gio
234+ GIO_NOT_SUPPORTED = gio.ERROR_NOT_SUPPORTED
235+else:
236+ from gi.repository import Gio as gio
237+ GIO_NOT_SUPPORTED = gio.IOErrorEnum.NOT_SUPPORTED
238
239 from twisted.internet import defer
240 from ubuntuone.devtools.handlers import MementoHandler
241@@ -42,7 +48,12 @@
242 def __init__(self, path):
243 pass
244
245- def trash(self):
246+ @classmethod
247+ def new_for_path(klass, path):
248+ """Fake new_for_path for GI."""
249+ return klass(path)
250+
251+ def trash(self, *args):
252 """Fake trash call."""
253 return self._bad_trash_call
254
255@@ -98,7 +109,7 @@
256
257 def test_movetotrash_file_systemnotcapable(self):
258 """The system is not capable of moving into trash."""
259- FakeGIOFile._bad_trash_call = gio.ERROR_NOT_SUPPORTED
260+ FakeGIOFile._bad_trash_call = GIO_NOT_SUPPORTED
261 self.patch(gio, "File", FakeGIOFile)
262 path = os.path.join(self.basedir, 'foo')
263 open_file(path, 'w').close()
264@@ -110,7 +121,7 @@
265
266 def test_movetotrash_dir_systemnotcapable(self):
267 """The system is not capable of moving into trash."""
268- FakeGIOFile._bad_trash_call = gio.ERROR_NOT_SUPPORTED
269+ FakeGIOFile._bad_trash_call = GIO_NOT_SUPPORTED
270 self.patch(gio, "File", FakeGIOFile)
271 path = os.path.join(self.basedir, 'foo')
272 os.mkdir(path)
273
274=== modified file 'tests/status/test_aggregator.py'
275--- tests/status/test_aggregator.py 2011-12-07 20:41:48 +0000
276+++ tests/status/test_aggregator.py 2012-01-26 19:33:54 +0000
277@@ -1580,3 +1580,5 @@
278 self.assertEqual(0, len(notifications_shown))
279 sf.queue_done()
280 self.assertEqual(0, len(notifications_shown))
281+
282+HundredFeetTestCase.skip = "libindicate-ERROR causes core dump: #922179"
283
284=== modified file 'ubuntuone/platform/linux/messaging.py'
285--- ubuntuone/platform/linux/messaging.py 2011-12-08 20:56:10 +0000
286+++ ubuntuone/platform/linux/messaging.py 2012-01-26 19:33:54 +0000
287@@ -23,14 +23,19 @@
288
289 import dbus
290 import subprocess
291+import sys
292
293 from time import time
294
295-try:
296- import indicate
297- USE_INDICATE = True
298-except ImportError:
299- USE_INDICATE = False
300+indicate = None
301+if 'gobject' in sys.modules and sys.modules['gobject'] is not None:
302+ import indicate as pyindicate
303+ indicate = pyindicate
304+ using_gi = False
305+else:
306+ from gi.repository import Indicate
307+ indicate = Indicate
308+ using_gi = True
309
310 DBUS_BUS_NAME = 'com.ubuntuone.controlpanel.gui'
311 DBUS_PATH = '/gui'
312@@ -73,41 +78,42 @@
313 """Notification of the end user."""
314
315 def __init__(self, server_callback=_server_callback):
316- if USE_INDICATE:
317- self.indicators = []
318+ self.indicators = []
319+ if using_gi:
320+ self.server = indicate.Server.ref_default()
321+ else:
322 self.server = indicate.indicate_server_ref_default()
323- self.server.connect("server-display", server_callback)
324- self.server.set_type("message.u1")
325- self.server.set_desktop_file(
326- "/usr/share/applications/ubuntuone-control-panel-gtk.desktop")
327- self.server.show()
328+ self.server.connect("server-display", server_callback)
329+ self.server.set_type("message.u1")
330+ self.server.set_desktop_file(
331+ "/usr/share/applications/ubuntuone-installer.desktop")
332+ self.server.show()
333
334 # pylint: disable=R0913
335 def show_message(self, sender, callback=None, message_time=None,
336 message_count=None, icon=None):
337 """Show a message in the messaging menu."""
338- if USE_INDICATE:
339- indicator = indicate.Indicator()
340- indicator.set_property("subtype", "u1")
341- indicator.set_property("name", sender)
342- indicator.set_property("sender", sender)
343-
344- if callback is None:
345- callback = self.create_callback()
346- indicator.connect("user-display", callback)
347-
348- if icon is not None:
349- indicator.set_property_icon("icon", icon)
350- if message_count is not None:
351- indicator.set_property("count", str(message_count))
352- else:
353- if message_time is None:
354- message_time = time()
355- indicator.set_property_time("time", message_time)
356- indicator.set_property("draw-attention", "true")
357- indicator.show()
358- self.indicators.append(indicator)
359- return indicator
360+ indicator = indicate.Indicator()
361+ indicator.set_property("subtype", "u1")
362+ indicator.set_property("name", sender)
363+ indicator.set_property("sender", sender)
364+
365+ if callback is None:
366+ callback = self.create_callback()
367+ indicator.connect("user-display", callback)
368+
369+ if icon is not None:
370+ indicator.set_property_icon("icon", icon)
371+ if message_count is not None:
372+ indicator.set_property("count", str(message_count))
373+ else:
374+ if message_time is None:
375+ message_time = time()
376+ indicator.set_property_time("time", message_time)
377+ indicator.set_property("draw-attention", "true")
378+ indicator.show()
379+ self.indicators.append(indicator)
380+ return indicator
381 # pylint: enable=R0913
382
383 def create_callback(self):
384@@ -123,6 +129,5 @@
385
386 def update_count(self, indicator, add_count):
387 """Update the count for an existing indicator."""
388- if USE_INDICATE:
389- new_count = int(indicator.get_property('count')) + add_count
390- indicator.set_property('count', str(new_count))
391+ new_count = int(indicator.get_property('count')) + add_count
392+ indicator.set_property('count', str(new_count))
393
394=== modified file 'ubuntuone/platform/linux/notification.py'
395--- ubuntuone/platform/linux/notification.py 2011-10-14 20:02:23 +0000
396+++ ubuntuone/platform/linux/notification.py 2012-01-26 19:33:54 +0000
397@@ -22,8 +22,10 @@
398 # notifications.
399
400 import sys
401+
402 NOTIFY_MODULE = None
403-if 'gi' in sys.modules:
404+
405+if 'gi' in sys.modules and sys.modules['gi'] is not None:
406 try:
407 from gi.repository import Notify
408 Notify # pyflakes
409
410=== modified file 'ubuntuone/platform/linux/os_helper.py'
411--- ubuntuone/platform/linux/os_helper.py 2011-10-14 20:02:23 +0000
412+++ ubuntuone/platform/linux/os_helper.py 2012-01-26 19:33:54 +0000
413@@ -29,7 +29,7 @@
414 import stat
415 import sys
416
417-if 'gobject' in sys.modules:
418+if 'gobject' in sys.modules and sys.modules['gobject'] is not None:
419 import gio
420 has_gi = False
421 else:
422
423=== removed file 'ubuntuone/syncdaemon/sdreactor.py'
424--- ubuntuone/syncdaemon/sdreactor.py 2011-10-14 20:02:23 +0000
425+++ ubuntuone/syncdaemon/sdreactor.py 1970-01-01 00:00:00 +0000
426@@ -1,79 +0,0 @@
427-"""
428-The SyncDaemon reactor -- a less power-hungry version of twisted's gtk2reactor
429-"""
430-#
431-# This is the quickest way to make twisted's Gtk2Reactor use
432-# timeout_add_seconds instead of timeout_add; the former uses high-resolution
433-# timers, which are more power-intensive.
434-# It's pretty much verbatim from their source.
435-
436-from twisted.python import log
437-from twisted.internet.main import installReactor
438-from twisted.internet.gtk2reactor import Gtk2Reactor
439-import gobject
440-
441-
442-class SyncDaemonReactor(Gtk2Reactor):
443- """
444- This is twisted.internet.Gtk2Reactor, but using timeout_add_seconds
445- instead of timeout_add.
446- """
447- def __init__(self, use_gtk):
448- Gtk2Reactor.__init__(self, use_gtk)
449- # ugh... why would somebody make these private?
450- self.__iteration = self._Gtk2Reactor__iteration
451- self.__pending = self._Gtk2Reactor__pending
452- self.__run = self._Gtk2Reactor__run
453-
454- def doIteration(self, delay):
455- """
456- Process some events
457- """
458- log.msg(channel='system', event='iteration', reactor=self)
459- if self.__pending():
460- self.__iteration(0)
461- return
462- # nothing to do, must delay
463- if delay == 0:
464- return # shouldn't delay, so just return
465- self.doIterationTimer = gobject.timeout_add_seconds(
466- int(delay), self.doIterationTimeout)
467- # This will either wake up from IO or from a timeout.
468- self.__iteration(1) # block
469- # note: with the .simulate timer below, delays > 0.1 will always be
470- # woken up by the .simulate timer
471- if self.doIterationTimer:
472- # if woken by IO, need to cancel the timer
473- gobject.source_remove(self.doIterationTimer)
474- self.doIterationTimer = None
475-
476- def run(self, installSignalHandlers=1):
477- """
478- See IReactorCore.run
479- """
480- self.startRunning(installSignalHandlers=installSignalHandlers)
481- gobject.timeout_add_seconds(0, self.simulate)
482- if self._started:
483- self.__run()
484-
485- def simulate(self):
486- """
487- Run simulation loops and reschedule callbacks.
488- """
489- if self._simtag is not None:
490- gobject.source_remove(self._simtag)
491- self.runUntilCurrent()
492- timeout = min(self.timeout(), 0.1)
493- if timeout is None:
494- timeout = 0.1
495- # grumble
496- self._simtag = gobject.timeout_add_seconds(int(timeout * 1010 / 1000),
497- self.simulate)
498-
499-
500-def install(use_gtk):
501- """
502- Configure the twisted mainloop to be run inside the glib mainloop.
503- If use_gtk, then use the gtk mainloop instead.
504- """
505- installReactor(SyncDaemonReactor(use_gtk))

Subscribers

People subscribed via source and target branches