Merge lp:~dobey/ubuntuone-client/nautilus-no-python into lp:ubuntuone-client

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 49
Merged at revision: not available
Proposed branch: lp:~dobey/ubuntuone-client/nautilus-no-python
Merge into: lp:ubuntuone-client
Diff against target: None lines
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/nautilus-no-python
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Elliot Murphy (community) Approve
Rick McBride (community) Approve
Review via email: mp+7565@code.launchpad.net

Commit message

[r=rmcbride, r=statik] Switch to autotools by default and update packaging for the changes

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

This is a fairly large diff, but I didn't really see any good way to do it in smaller atomic changes. After running ./autogen.sh, doing 'make dist' will give a tarball, which we can use for packaging. The setup.py is generated now (so that we get the same version number in it and the autotools bits), and is very minimal at this point. The rest of the pieces will be moved out as well, at a later time, but for now we need it to run pylint, install the icons, and build u1fsfsm when it needs to be rebuilt. Tests can be run with 'make check', though are disabled during distcheck, because I didn't want to waste time fixing all the tests to load stuff from $(srcdir) properly when $(builddir) is different. The distcheck command also currently fails, because setup.py doesn't have an uninstall command, and we use it to install the icons, so files end up getting left around.

After landing this, I want to tag 0.90.2 for storage-protocol and client both, and get tarballs on our launchpad downloads page, and the 0.90.2 version up on REVU for inclusion in karmic.

Revision history for this message
Rick McBride (rmcbride) wrote :

This looks great!

review: Approve
Revision history for this message
Elliot Murphy (statik) wrote :

I get this error from running ./autogen.sh:

checking for NAUTILUS... configure: error: Package requirements (libnautilus-extension >= 2.6.0 libsoup-2.4 >= 2.3.0) were not met:

Package @GDK_PRIVATE_PACKAGES@ was not found in the pkg-config search path.
Perhaps you should add the directory containing `@GDK_PRIVATE_PACKAGES@.pc'
to the PKG_CONFIG_PATH environment variable
Package '@GDK_PRIVATE_PACKAGES@', required by 'GDK', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables NAUTILUS_CFLAGS
and NAUTILUS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

I have:
libnautilus-extension-dev:
  Installed: 1:2.27.2-0ubuntu1

libsoup2.4-dev:
  Installed: 2.27.1-0ubuntu1

This is with current Karmic.

Revision history for this message
Elliot Murphy (statik) wrote :

Great work. Thanks for suffering all my questions on IRC.

review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Please add entries to the changelog for dropping the nautlus-python dep and the deps that have been added. Also include LP bug numbers like (LP: #SOMENUMBER) in the changelog

47. By dobey

 Fix a thinko with creating the protocol symlink

48. By dobey

 Remove dependency on libsoup and code using it
 Update debian/changelog with more info as per Ken's review

49. By dobey

 Rename all to all-local
 Add depenedncy on all-local rule to check rule

Revision history for this message
dobey (dobey) wrote :

> Please add entries to the changelog for dropping the nautlus-python dep and
> the deps that have been added. Also include LP bug numbers like (LP:
> #SOMENUMBER) in the changelog

I've updated changelog as per this comment, and fixed a few other small issues as well. In the interest of getting things done, I'm going to get this landed with Rick and Elliot's prior approvals. If small issues continue to crop up (like test -e failing for you), we can look at those individually and resolve with smaller branches.

Revision history for this message
Ken VanDine (ken-vandine) wrote :

I am having some issues testing it here, but it seems to work for others. The packaging looks good to me, lets send it to REVU. Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-06-03 20:30:50 +0000
3+++ .bzrignore 2009-06-17 16:08:17 +0000
4@@ -4,13 +4,22 @@
5 POTFILES
6 build
7 dist
8+m4
9+ubuntuone-client-[0-9]+.*
10 _trial_temp
11 libtool
12 ltmain.sh
13+setup.py
14 stamp-it
15+*.desktop
16 *.gmo
17+*.icon
18 *.la
19 *.lo
20 *_pb2.py
21 *.pot
22 *.pyc
23+*.rendercache
24+*.service
25+.intltool-merge-cache
26+
27
28=== modified file 'Makefile.am'
29--- Makefile.am 2009-06-03 20:30:50 +0000
30+++ Makefile.am 2009-06-17 16:46:42 +0000
31@@ -1,15 +1,106 @@
32-SUBDIRS = nautilus po
33-
34-MAINTAINERCLEANFILES = \
35- Makefile.in \
36- aclocal.m4 \
37- config.guess \
38- config.h.in \
39- config.sub \
40- configure \
41- depcomp \
42- install-sh \
43- libtool \
44- ltmain.sh \
45- missing \
46+DISTCHECK_CONFIGURE_FLAGS = --disable-rendering
47+
48+SUBDIRS = data nautilus po
49+
50+# Shut libtoolize up
51+ACLOCAL_AMFLAGS = -I m4
52+
53+# PYTHONPATH for setup.py and stuff
54+PYTHONPATH="$(top_srcdir):$(top_builddir)"
55+
56+# Python packages we want to install
57+pyshareddir = $(datadir)/pyshared
58+pypackages = \
59+ canonical/ubuntuone/oauthdesktop \
60+ canonical/ubuntuone/storage/syncdaemon/fsm \
61+ canonical/ubuntuone/storage/syncdaemon \
62+ canonical/ubuntuone/storage/u1sync
63+
64+# Install our scripts and extra data here
65+bin_SCRIPTS = \
66+ bin/ubuntuone-client-applet \
67+ bin/u1sdtool \
68+ bin/u1sync
69+
70+libexec_SCRIPTS = bin/ubuntuone-syncdaemon
71+
72+manfilesdir = $(mandir)/man1
73+manfiles_DATA = \
74+ docs/man/ubuntuone-client-applet.1 \
75+ docs/man/u1sdtool.1 \
76+ docs/man/u1sync.1
77+
78+apportdir = $(datadir)/apport/package-hooks
79+apport_DATA = apport/source_ubuntuone-client.py
80+
81+# Don't end up pulling in storage-protocol source as well
82+pyfiles = $(shell SRCDIR="$(top_srcdir)/canonical"; for i in `find $$SRCDIR -type f`; do printf "$$i "; done)
83+
84+check: setup.py Makefile
85+ if test "x$(builddir)" == "x$(srcdir)"; then \
86+ PYTHONPATH="$(PYTHONPATH)" $(PYTHON) setup.py check --config-file=$(top_srcdir)/pylintrc; \
87+ PYTHONPATH="$(PYTHONPATH)" $(PYTHON) $(srcdir)/contrib/test; \
88+ fi
89+ rm -rf _trial_temp
90+
91+all: all-recursive
92+ if test "x$(builddir)" == "x$(srcdir)"; then \
93+ if [ ! -e canonical/ubuntuone/storage/protocol ]; then \
94+ $(LN_S) $(USP_PATH) canonical/ubuntuone/storage/protocol; \
95+ fi; \
96+ fi
97+
98+install-data-local: setup.py
99+ for package in $(pypackages); do \
100+ $(mkdir_p) $(DESTDIR)$(pyshareddir)/$$package; \
101+ for module in $(top_srcdir)/$$package/*.py; do \
102+ $(install_sh_DATA) $$module $(DESTDIR)$(pyshareddir)/$$package; \
103+ done; \
104+ done
105+ if test -z "$(DESTDIR)"; then \
106+ PYTHONPATH="$(PYTHONPATH)" $(PYTHON) setup.py install --prefix=$(prefix) --no-compile -O0 --install-layout=deb; \
107+ else \
108+ PYTHONPATH="$(PYTHONPATH)" $(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(prefix) --no-compile -O0 --install-layout=deb; \
109+ fi
110+
111+uninstall-local:
112+ for package in $(pypackages); do \
113+ for module in $(top_srcdir)/$$package/*.py; do \
114+ modname=`basename $$module`; \
115+ rm -f $(DESTDIR)$(pyshareddir)/$$package/$$modname; \
116+ done; \
117+ rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(pyshareddir)/$$package; \
118+ done
119+
120+clean-local:
121+ PYTHONPATH="$(PYTHONPATH)" $(PYTHON) setup.py clean
122+ for i in `find $(builddir) -name "*.pyc"`; do \
123+ rm -f $$i; \
124+ done
125+ rm -f canonical/ubuntuone/storage/protocol
126+ rm -rf build dist _trial_temp
127+
128+EXTRA_DIST = \
129+ $(pyfiles) \
130+ COPYING.icons \
131+ apport \
132+ bin \
133+ contrib \
134+ docs \
135+ tests \
136+ pylintrc \
137+ setup.cfg
138+
139+MAINTAINERCLEANFILES = \
140+ Makefile.in \
141+ aclocal.m4 \
142+ config.guess \
143+ config.h.in \
144+ config.sub \
145+ configure \
146+ depcomp \
147+ install-sh \
148+ libtool \
149+ ltmain.sh \
150+ missing \
151 mkinstalldirs
152
153=== modified file 'autogen.sh'
154--- autogen.sh 2009-05-30 12:08:32 +0000
155+++ autogen.sh 2009-06-17 16:08:17 +0000
156@@ -4,7 +4,7 @@
157 srcdir=`dirname $0`
158 test -z "$srcdir" && srcdir=.
159
160-PKG_NAME="central-services"
161+PKG_NAME="ubuntuone-client"
162 REQUIRED_AUTOMAKE_VERSION="1.6"
163
164 (test -f $srcdir/configure.ac) || {
165@@ -14,7 +14,7 @@
166 }
167
168 which gnome-autogen.sh || {
169- echo "You need to install gnome-common from the GNOME CVS"
170+ echo "You need to install gnome-common from the GNOME source repository"
171 exit 1
172 }
173
174
175=== removed directory 'canonical/ubuntuone/nautilus'
176=== removed file 'canonical/ubuntuone/nautilus/__init__.py'
177--- canonical/ubuntuone/nautilus/__init__.py 2009-05-12 13:36:05 +0000
178+++ canonical/ubuntuone/nautilus/__init__.py 1970-01-01 00:00:00 +0000
179@@ -1,16 +0,0 @@
180-# canonical.ubuntuone.nautilus - Ubuntu One integration with Nautilus
181-#
182-# Copyright 2009 Canonical Ltd.
183-#
184-# This program is free software: you can redistribute it and/or modify it
185-# under the terms of the GNU General Public License version 3, as published
186-# by the Free Software Foundation.
187-#
188-# This program is distributed in the hope that it will be useful, but
189-# WITHOUT ANY WARRANTY; without even the implied warranties of
190-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
191-# PURPOSE. See the GNU General Public License for more details.
192-#
193-# You should have received a copy of the GNU General Public License along
194-# with this program. If not, see <http://www.gnu.org/licenses/>.
195-"""Ubuntu One Nautilus integration."""
196
197=== removed file 'canonical/ubuntuone/nautilus/dummy_nautilus.py'
198--- canonical/ubuntuone/nautilus/dummy_nautilus.py 2009-05-12 13:36:05 +0000
199+++ canonical/ubuntuone/nautilus/dummy_nautilus.py 1970-01-01 00:00:00 +0000
200@@ -1,36 +0,0 @@
201-# canonical.ubuntuone.nautilus.dummy_nautilus - stub Nautilus API
202-#
203-# Author: Tim Cole <tim.cole@canonical.com>
204-#
205-# Copyright 2009 Canonical Ltd.
206-#
207-# This program is free software: you can redistribute it and/or modify it
208-# under the terms of the GNU General Public License version 3, as published
209-# by the Free Software Foundation.
210-#
211-# This program is distributed in the hope that it will be useful, but
212-# WITHOUT ANY WARRANTY; without even the implied warranties of
213-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
214-# PURPOSE. See the GNU General Public License for more details.
215-#
216-# You should have received a copy of the GNU General Public License along
217-# with this program. If not, see <http://www.gnu.org/licenses/>.
218-"""Replacement stubs for the Nautilus extension API."""
219-
220-class LocationWidgetProvider(object):
221- """Stub base class for location widget providers."""
222- pass
223-
224-
225-class InfoProvider(object):
226- """Stub base class for file info providers."""
227- pass
228-
229-class MenuProvider(object):
230- """Stub base class for menu providers."""
231- pass
232-
233-
234-class MenuItem(object):
235- """Stub base class for menu items."""
236- pass
237
238=== removed file 'canonical/ubuntuone/nautilus/nautilus_api.py'
239--- canonical/ubuntuone/nautilus/nautilus_api.py 2009-05-12 13:36:05 +0000
240+++ canonical/ubuntuone/nautilus/nautilus_api.py 1970-01-01 00:00:00 +0000
241@@ -1,51 +0,0 @@
242-# canonical.ubuntuone.nautilus.nautilus_api - provide Nautilus API
243-#
244-# Author: Tim Cole <tim.cole@canonical.com>
245-#
246-# Copyright 2009 Canonical Ltd.
247-#
248-# This program is free software: you can redistribute it and/or modify it
249-# under the terms of the GNU General Public License version 3, as published
250-# by the Free Software Foundation.
251-#
252-# This program is distributed in the hope that it will be useful, but
253-# WITHOUT ANY WARRANTY; without even the implied warranties of
254-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
255-# PURPOSE. See the GNU General Public License for more details.
256-#
257-# You should have received a copy of the GNU General Public License along
258-# with this program. If not, see <http://www.gnu.org/licenses/>.
259-"""A wrapper module to conditionally import the Nautilus extension API
260-when it is available; otherwise, import stubs for it.
261-
262-"""
263-
264-from __future__ import absolute_import
265-
266-try:
267- # pylint: disable-msg=W0403,W0611,F0401
268- from nautilus import LocationWidgetProvider
269-except ImportError:
270- from canonical.ubuntuone.nautilus.dummy_nautilus import \
271- LocationWidgetProvider
272-
273-
274-try:
275- # pylint: disable-msg=W0403,W0611,F0401
276- from nautilus import InfoProvider
277-except ImportError:
278- from canonical.ubuntuone.nautilus.dummy_nautilus import InfoProvider
279-
280-
281-try:
282- # pylint: disable-msg=W0403,W0611,F0401
283- from nautilus import MenuProvider
284-except ImportError:
285- from canonical.ubuntuone.nautilus.dummy_nautilus import MenuProvider
286-
287-
288-try:
289- # pylint: disable-msg=W0403,W0611,F0401
290- from nautilus import MenuItem
291-except ImportError:
292- from canonical.ubuntuone.nautilus.dummy_nautilus import MenuItem
293
294=== removed file 'canonical/ubuntuone/nautilus/storage.py'
295--- canonical/ubuntuone/nautilus/storage.py 2009-05-18 02:04:33 +0000
296+++ canonical/ubuntuone/nautilus/storage.py 1970-01-01 00:00:00 +0000
297@@ -1,499 +0,0 @@
298-# canonical.ubuntuone.nautilus.storage - storage extension for Nautilus
299-#
300-# Authors: Tim Cole <tim.cole@canonical.com>
301-# Rodney Dawes <rodney.dawes@canonical.com>
302-#
303-# Copyright 2009 Canonical Ltd.
304-#
305-# This program is free software: you can redistribute it and/or modify it
306-# under the terms of the GNU General Public License version 3, as published
307-# by the Free Software Foundation.
308-#
309-# This program is distributed in the hope that it will be useful, but
310-# WITHOUT ANY WARRANTY; without even the implied warranties of
311-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
312-# PURPOSE. See the GNU General Public License for more details.
313-#
314-# You should have received a copy of the GNU General Public License along
315-# with this program. If not, see <http://www.gnu.org/licenses/>.
316-"""Storage extension for Nautilus."""
317-
318-from __future__ import with_statement
319-
320-import os
321-import gtk
322-import gnomekeyring
323-from urlparse import urlparse
324-from urllib import url2pathname, urlencode
325-from urllib2 import urlopen, Request, HTTPError
326-from twisted.internet import defer
327-from twisted.python import failure
328-from threading import Thread
329-import canonical.ubuntuone.nautilus.nautilus_api as nautilus
330-import dbus.service
331-from dbus.exceptions import DBusException
332-from dbus.mainloop.glib import DBusGMainLoop
333-from gettext import gettext as _
334-
335-from canonical.ubuntuone.storage.protocol import oauth
336-from canonical.ubuntuone.storage.syncdaemon.dbus_interface import (
337- DBUS_IFACE_NAME, DBUS_IFACE_SYNC_NAME, DBUS_IFACE_STATUS_NAME,
338- DBUS_IFACE_SHARES_NAME, DBUS_IFACE_FS_NAME)
339-from canonical.ubuntuone.storage.syncdaemon import states
340-
341-DBusGMainLoop(set_as_default=True)
342-
343-class StorageBar(gtk.HBox):
344- """The storage bar widget."""
345-
346- def __init__(self, path, *args, **kw):
347- """Initialize the widget."""
348- super(StorageBar, self).__init__(*args, **kw)
349- self.__label = gtk.Label()
350- self.__label.set_markup("<b>Ubuntu One</b> " + _("File Sharing"))
351- self.__label.set_alignment(0.0, 0.5)
352- self.__label.show()
353- self.add(self.__label)
354- self.__button = gtk.Button()
355- self.__button.connect("clicked", self.__toggle_state)
356- self.__button.show()
357- self.pack_end(self.__button, expand=False, fill=False)
358- self.__path = path
359- self.__connected = False
360- self.__bus = dbus.SessionBus()
361- self.__update_status({'name':states.INIT.name})
362-
363- self.__bus.add_signal_receiver(
364- handler_function=self.__update_status,
365- signal_name="StatusChanged",
366- dbus_interface=DBUS_IFACE_STATUS_NAME)
367-
368- # Now get the current status
369- def status_error(error):
370- """Handle status error."""
371- return
372-
373- # pylint: disable-msg=W0704
374- try:
375- client = self.__bus.get_object(DBUS_IFACE_NAME, "/status")
376- iface = dbus.Interface(client, DBUS_IFACE_STATUS_NAME)
377- iface.current_status(reply_handler=self.__update_status,
378- error_handler=status_error)
379- except DBusException:
380- pass
381-
382-
383- def __toggle_state(self, button):
384- """Toggle the connectivity state."""
385- def handler():
386- """Simple handler to make dbus do stuff async."""
387- return
388-
389- try:
390- client = self.__bus.get_object(DBUS_IFACE_NAME, "/")
391- iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME)
392- if self.__connected:
393- iface.disconnect(reply_handler=handler, error_handler=handler)
394- else:
395- iface.connect(reply_handler=handler, error_handler=handler)
396- except DBusException:
397- return
398-
399- def __update_status(self, status):
400- """Update the label, and button when connection status changes."""
401- if not status.get('is_online', False) or \
402- not status.get('is_connected', False) or \
403- status['name'].startswith("INIT") or \
404- status['name'].startswith("READY"):
405- self.__button.set_label(_("Connect"))
406- self.__connected = False
407- else:
408- self.__button.set_label(_("Disconnect"))
409- self.__connected = True
410-
411-
412-managed = None
413-def is_storagefs(path):
414- """Returns True if the given path is a directory in a mounted
415- storagefs filesystem.
416-
417- @param path: the path to test
418- @return: True if the path is a directory in storagefs
419- """
420- # pylint: disable-msg=W0602
421- global managed
422- if not managed:
423- bus = dbus.SessionBus()
424- try:
425- client = bus.get_object(DBUS_IFACE_NAME, "/")
426- iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME)
427- def got_root(root):
428- """Got the managed root dir."""
429- # pylint: disable-msg=W0603
430- global managed
431- managed = root
432-
433- def got_error(error):
434- """Simple handler to make dbus to stuff async."""
435- raise DBusException(error)
436-
437- iface.get_rootdir(reply_handler=got_root, error_handler=got_error)
438- except DBusException:
439- return False
440-
441- if not managed:
442- return False
443-
444- return path == managed or path.startswith(managed + "/")
445-
446-
447-class StorageBarProvider(nautilus.LocationWidgetProvider):
448- """An extension class providing a location widget for storage
449- directories.
450-
451- """
452- # pylint: disable-msg=W0231
453- def __init__(self, widget_class=StorageBar,
454- is_storagefs=is_storagefs):
455- """Initializes a new instance of the extension class."""
456- self.__widget_class = widget_class
457- self.__storagefs_test = is_storagefs
458-
459- def _get_storage_dir_path(self, url):
460- """Gets the local filesystem path corresponding to the given URL,
461- or otherwise None if it does not refer to a storage directory.
462-
463- @param url: the directory URL
464- @return: the local filesystem path, or else None
465-
466- """
467- parsed_url = urlparse(url)
468- if parsed_url.scheme == "file" and parsed_url.path:
469- path = url2pathname(parsed_url.path)
470- if self.__storagefs_test(path):
471- return path
472- else:
473- return None
474- else:
475- return None
476-
477- def get_widget(self, url, window):
478- """Returns either None or a Gtk widget to decorate the Nautilus
479- window with, based on whether the current directory is a storage
480- directory.
481-
482- @param url: the URL of the currently viewed directory
483- @param window: the Nautilus window
484- @return: a Gtk widget or None
485-
486- """
487- path = self._get_storage_dir_path(url)
488- if path is not None:
489- widget = self.__widget_class(path=path)
490- widget.show()
491- return widget
492- else:
493- return None
494-
495-
496-class StorageInfoProvider(nautilus.InfoProvider):
497- """An extension class providing info for storage files."""
498-
499- # pylint: disable-msg=W0231
500- def __init__(self, *args, **kw):
501- """Initializes the StorageInfoProvider class."""
502- self.__shared = []
503- self.__downloads = []
504- self.__uploads = []
505-
506- self.__bus = dbus.SessionBus()
507-
508- self.__bus.add_signal_receiver(
509- handler_function=self.__share_created,
510- signal_name="ShareCreated",
511- dbus_interface=DBUS_IFACE_SHARES_NAME)
512-
513- self.__bus.add_signal_receiver(
514- handler_function=self.__dl_started,
515- signal_name="DownloadStarted",
516- dbus_interface=DBUS_IFACE_STATUS_NAME)
517- self.__bus.add_signal_receiver(
518- handler_function=self.__dl_finished,
519- signal_name="DownloadFinished",
520- dbus_interface=DBUS_IFACE_STATUS_NAME)
521- self.__bus.add_signal_receiver(
522- handler_function=self.__ul_started,
523- signal_name="UploadStarted",
524- dbus_interface=DBUS_IFACE_STATUS_NAME)
525- self.__bus.add_signal_receiver(
526- handler_function=self.__ul_finished,
527- signal_name="UploadFinished",
528- dbus_interface=DBUS_IFACE_STATUS_NAME)
529-
530- def __share_created(self, share):
531- """Share was created, add it to our list"""
532- self.__shares.append(share['path'])
533-
534- def __dl_started(self, path):
535- """Download started."""
536- if os.path.isdir(path):
537- self.__downloads.append(path)
538- else:
539- self.__downloads.append(path + ".partial")
540- if not os.path.exists(path + ".partial"):
541- with open(path + ".partial", "w") as f:
542- pass
543- os.utime(path + ".partial", None)
544-
545- def __dl_finished(self, path):
546- """Download finished."""
547- if self.__downloads:
548- try:
549- if os.path.isdir(path):
550- self.__downloads.remove(path)
551- else:
552- self.__downloads.remove(path + ".partial")
553- except ValueError:
554- return
555-
556- def __ul_started(self, path):
557- """Upload started."""
558- self.__uploads.append(path)
559- os.utime(path, None)
560-
561- def __ul_finished(self, path):
562- """Upload finished."""
563- os.utime(path, None)
564- if self.__uploads:
565- try:
566- self.__uploads.remove(path)
567- except ValueError:
568- return
569-
570- def update_file_info(self, file):
571- """Returns either None or an int to update the file information.
572-
573- @param file: the file to update the status of
574- @return: int or None
575- """
576- path = url2pathname(urlparse(file.get_uri()).path)
577-
578- if not is_storagefs(os.path.dirname(path)):
579- return 0
580-
581- # We need to get the status from the sync daemon and assign emblems
582- # here, like we used to do for fuse before stuff started crashing :)
583- # We also need some useful pretty emblems to use here
584- def got_error(error):
585- """DBus async error handler."""
586- raise DBusException(error)
587-
588- if not self.__shared:
589- try:
590- client = self.__bus.get_object(DBUS_IFACE_NAME, "/shares")
591- iface = dbus.Interface(client, DBUS_IFACE_SHARES_NAME)
592- def got_shared(shared):
593- """Got the managed root dir."""
594- self.__shared = [share['path'] for share in shared]
595-
596- iface.get_shared(reply_handler=got_shared,
597- error_handler=got_error)
598- except DBusException:
599- return False
600-
601- if path in self.__shared:
602- file.add_emblem("shared")
603-
604- if path in self.__downloads:
605- file.add_emblem("ubuntuone-downloading")
606-
607- if path in self.__uploads:
608- file.add_emblem("ubuntuone-uploading")
609-
610-
611-class OfferCancelled(Exception):
612- """The cancel button was clicked."""
613- pass
614-
615-def show_create_share_dialog(folder, window):
616- """Create the share offer dialog and present it to the user."""
617- d = defer.Deferred()
618-
619- def create_share(*args, **kwargs):
620- """Create the share."""
621- path = kwargs.get("path", None)
622- user = kwargs.get("user", None)
623- name = kwargs.get("name", None)
624- modify = kwargs.get("modify", False)
625-
626- if path == None or user == None or name == None:
627- d.errback(failure.Failure(Exception("Invalid arguments.")))
628- return
629-
630- bus = dbus.SessionBus()
631- node = None
632- failed = False
633- try:
634- client = bus.get_object(DBUS_IFACE_NAME, "/filesystem")
635- iface = dbus.Interface(client, DBUS_IFACE_FS_NAME)
636- node = iface.get_metadata(path)["node_id"]
637- except DBusException, e:
638- d.errback(failure.Failure(e))
639- return
640-
641- if failed:
642- return
643-
644- consumer = oauth.OAuthConsumer("ubuntuone", "hammertime")
645- items = []
646- try:
647- items = gnomekeyring.find_items_sync(
648- gnomekeyring.ITEM_GENERIC_SECRET,
649- {'ubuntuone-realm': "https://ubuntuone.com",
650- 'oauth-consumer-key': consumer.key})
651- except (gnomekeyring.NoMatchError,
652- gnomekeyring.DeniedError), e:
653- d.errback(failure.Failure(e))
654- return
655-
656- url = "https://ubuntuone.com/files/api/offer_share/"
657- token = oauth.OAuthToken.from_string(items[0].secret)
658- method = oauth.OAuthSignatureMethod_PLAINTEXT()
659- request = oauth.OAuthRequest.from_consumer_and_token(
660- http_url=url,
661- http_method="POST",
662- oauth_consumer=consumer,
663- token=token)
664- request.sign_request(method, consumer, token)
665- data = dict(offer_to_email = user,
666- read_only = modify != True,
667- node_id = node,
668- share_name = name)
669- pdata = urlencode(data)
670- headers = request.to_header()
671- req = Request(url, pdata, headers)
672- try:
673- resp = urlopen(req)
674- d.callback(path)
675- except HTTPError, e:
676- d.errback(failure.Failure(e))
677-
678-
679- def dialog_response(dialog, response, path,
680- user_entry, name_entry, modify):
681- """Handle the response on the dialog."""
682- if response == gtk.RESPONSE_ACCEPT:
683- create_args = dict(path = path,
684- user = user_entry.get_text(),
685- name = name_entry.get_text(),
686- modify = modify.get_active())
687- Thread(target=create_share, kwargs=create_args).start()
688- else:
689- d.errback(failure.Failure(OfferCancelled()))
690-
691- # Always destroy the dialog
692- dialog.destroy()
693-
694- dialog = gtk.Dialog(title=_("Share on Ubuntu One"), parent=window,
695- flags=gtk.DIALOG_DESTROY_WITH_PARENT | \
696- gtk.DIALOG_NO_SEPARATOR,
697- buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
698- _("_Share"), gtk.RESPONSE_ACCEPT))
699- dialog.set_default_response(gtk.RESPONSE_ACCEPT)
700- dialog.set_icon_name("ubuntuone-client")
701-
702- area = dialog.get_content_area()
703-
704- table = gtk.Table(rows=3, columns=2)
705- table.set_row_spacings(12)
706- table.set_col_spacings(6)
707- table.set_border_width(7)
708- table.show()
709- area.add(table)
710-
711- label = gtk.Label(_("Share _with (e-mail):"))
712- label.set_alignment(0.0, 0.5)
713- label.set_use_underline(True)
714- table.attach(label, 0, 1, 0, 1)
715- label.show()
716- user_entry = gtk.Entry()
717- label.set_mnemonic_widget(user_entry)
718- table.attach(user_entry, 1, 2, 0, 1)
719- user_entry.show()
720-
721- label = gtk.Label(_("Share _Name:"))
722- label.set_alignment(0.0, 0.5)
723- label.set_use_underline(True)
724- table.attach(label, 0, 1, 1, 2)
725- label.show()
726- name_entry = gtk.Entry()
727- label.set_mnemonic_widget(name_entry)
728- name_entry.set_text(os.path.basename(folder))
729- name_entry.set_activates_default(True)
730- table.attach(name_entry, 1, 2, 1, 2)
731- name_entry.show()
732-
733- modify = gtk.CheckButton(label=_("_Allow Modification"), use_underline=True)
734- table.attach(modify, 0, 2, 2, 3)
735- modify.show()
736-
737- dialog.connect('close', dialog_response, gtk.RESPONSE_CANCEL,
738- folder, user_entry, name_entry, modify)
739- dialog.connect('response', dialog_response,
740- folder, user_entry, name_entry, modify)
741-
742- dialog.show()
743-
744- return d
745-
746-class StorageMenuProvider(nautilus.MenuProvider):
747- """An extension class providing menu items for Ubuntu One folders."""
748- # pylint: disable-msg=W0231
749- def __init__(self, *args, **kw):
750- pass
751-
752- def __share_succeeded(self, path):
753- """Share offer was successful."""
754- os.utime(path, None)
755-
756- def __share_failed(self, error):
757- """Share offer failed."""
758- if isinstance(error, OfferCancelled):
759- return
760- else:
761- # XXX Should notify the user of the problem
762- return
763-
764- def __share_folder(self, widget, folder, window):
765- """Share the folder already."""
766- d = show_create_share_dialog(folder, window)
767- d.addCallbacks(self.__share_succeeded, self.__share_failed)
768-
769- def get_file_items(self, window, files):
770- """Give ourselves some nice menu items for Ubuntu One."""
771- if len(files) != 1:
772- return
773-
774- file = files[0]
775- path = url2pathname(urlparse(file.get_uri()).path)
776-
777- if not is_storagefs(os.path.dirname(path)):
778- return
779-
780- if path.startswith(os.path.join(managed, "Shared with Me")):
781- return
782-
783- if file.is_directory():
784- item = nautilus.MenuItem("ubuntuone-share",
785- _("Share on Ubuntu One"),
786- _("Share this folder on Ubuntu One"),
787- icon="ubuntuone-client")
788- item.connect('activate', self.__share_folder, path, window)
789- return item,
790-
791- return
792-
793- def get_background_items(self, window, file):
794- """Give ourselves a menu item for Ubuntu One folders."""
795- files = [file]
796- return self.get_file_items(window, files)
797
798=== modified file 'configure.ac'
799--- configure.ac 2009-06-14 21:30:07 +0000
800+++ configure.ac 2009-06-17 16:08:17 +0000
801@@ -10,6 +10,7 @@
802 AC_ISC_POSIX
803 AC_PROG_CC
804 AC_PROG_LIBTOOL
805+PKG_PROG_PKG_CONFIG([0.19])
806 IT_PROG_INTLTOOL([0.40.0])
807
808 GETTEXT_PACKAGE="${PACKAGE}"
809@@ -20,6 +21,49 @@
810 localedir='${prefix}/${DATADIRNAME}/locale'
811 AC_SUBST(localedir)
812
813+# Workaround to make aclocal get the right flags
814+AC_CONFIG_MACRO_DIR([m4])
815+AC_SUBST(ACLOCAL_AMFLAGS, "\${ACLOCAL_FLAGS} -I m4")
816+
817+# Need lndir for builddir != srcdir builds, because Python is not sane
818+AC_PATH_PROG([LNDIR], [lndir], [false])
819+
820+# Icon sizes we want to install
821+AC_SUBST([render_sizes], ["16x16 24x24 32x32 48x48"])
822+
823+# Do we want to enable rendering?
824+AC_ARG_ENABLE([rendering],
825+ AC_HELP_STRING([--enable-rendering],
826+ [Enable icon rendering [default=auto]]),
827+ [enable_rendering=$enableval],
828+ [enable_rendering=yes])
829+
830+if test "x$enable_rendering" = "xyes"; then
831+ AC_PATH_PROG([ICONTOOL_RENDER], [icontool-render], [false])
832+ if test "x$ICONTOOL_RENDER" = "xfalse"; then
833+ AC_MSG_WARN([icontool is required to generate icons])
834+ enable_rendering=no
835+ fi
836+fi
837+AM_CONDITIONAL(ENABLE_RENDERING, test "x$enable_rendering" = "xyes")
838+
839+# Check for python 2.5
840+AM_PATH_PYTHON([2.5])
841+
842+# Specify the path for ubuntuone-storage-protocol source
843+AC_ARG_WITH([protocol],
844+ AC_HELP_STRING([--with-protocol],
845+ [Specify path to storage protocol [default=auto]]),
846+ [with_protocol=$withval],
847+ [with_protocol=auto])
848+USP_PATH=""
849+if test "x$with_protocol" = "xauto"; then
850+ USP_PATH="/usr/share/pyshared"
851+fi
852+AC_SUBST(USP_PATH)
853+AM_CONDITIONAL(USE_PROTOCOL, test "x$with_protocol" != "xno")
854+
855+# Stuff we need to build the extension shlib
856 PKG_CHECK_MODULES(NAUTILUS, [libnautilus-extension >= 2.6.0 libsoup-2.4 >= 2.3.0])
857 AC_SUBST(NAUTILUS_CFLAGS)
858 AC_SUBST(NAUTILUS_LIBS)
859@@ -44,8 +88,10 @@
860
861 AC_CONFIG_FILES([
862 Makefile
863+data/Makefile
864 nautilus/Makefile
865 po/Makefile.in
866+setup.py
867 ])
868
869 AC_OUTPUT
870
871=== added file 'data/Makefile.am'
872--- data/Makefile.am 1970-01-01 00:00:00 +0000
873+++ data/Makefile.am 2009-06-17 16:08:17 +0000
874@@ -0,0 +1,115 @@
875+
876+configdir = $(sysconfdir)/xdg/ubuntuone
877+config_DATA = oauth_urls syncdaemon.conf
878+
879+oauthdir = $(configdir)/oauth_registration.d
880+oauth_DATA = oauth_registration.d/ubuntuone
881+
882+desktopdir = $(datadir)/applications
883+desktop_in_files = ubuntuone-client-applet.desktop.in
884+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
885+
886+@INTLTOOL_DESKTOP_RULE@
887+
888+emblemthemedir = $(datadir)/icons/hicolor
889+emblem_in_files = \
890+ emblem-ubuntuone-downloading.icon.in \
891+ emblem-ubuntuone-unsynchronized.icon.in \
892+ emblem-ubuntuone-uploading.icon.in
893+emblem_files = $(emblem_in_files:.icon.in=.icon)
894+
895+%.icon: %.icon.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
896+
897+servicedir = $(DBUS_SERVICES_DIR)
898+service_in_files = \
899+ com.ubuntuone.Authentication.service.in \
900+ com.ubuntuone.SyncDaemon.service.in
901+service_DATA = $(service_in_files:.service.in=.service)
902+
903+%.service: %.service.in
904+ @sed -e "s|\@libexecdir\@|$(libexecdir)|" \
905+ -e "s|\@bindir\@|$(bindir)|" $< > $@
906+
907+icon_in_files = ubuntuone-icons.svg ubuntuone-animations.svg
908+icon_cache = $(icon_in_files:.svg=.rendercache)
909+icon_files = $(shell BUILDDIR="$(builddir)"; for i in `find $$BUILDDIR -name "*.rendercache"`; do cat $$i|sort|uniq; done)
910+
911+hicolor:
912+ if [ ! -h hicolor -a -d icons ]; then \
913+ $(LN_S) icons hicolor; \
914+ fi
915+
916+if ENABLE_RENDERING
917+
918+%.rendercache: %.svg hicolor
919+ for size in $(render_sizes); do \
920+ $(ICONTOOL_RENDER) -s $$size -o $(builddir)/icons $< > $@; \
921+ done
922+
923+dist-hook: $(icon_cache)
924+ $(mkdir_p) $(distdir)/icons
925+ for size in $(render_sizes); do \
926+ cp -a $(builddir)/icons/$$size $(distdir)/icons/$$size; \
927+ done
928+ for i in $(icon_cache); do \
929+ touch $(distdir)/$$i; \
930+ done
931+
932+else
933+
934+%.rendercache: %.svg hicolor
935+ if test "x$(builddir)" != "x$(srcdir)" -a ! -f stamp-render; then \
936+ $(mkdir_p) $(builddir)/icons; \
937+ for size in $(render_sizes); do \
938+ cp -a $(srcdir)/icons/$$size icons/$$size; \
939+ done; \
940+ touch stamp-render; \
941+ fi
942+
943+dist-hook: $(icon_cache)
944+ $(mkdir_p) $(distdir)/icons
945+ for size in $(render_sizes); do \
946+ cp -a $(srcdir)/icons/$$size $(distdir)/icons/$$size; \
947+ done
948+
949+endif
950+
951+all: $(icon_cache) $(emblem_files)
952+$(render_sizes): $(icon_cache)
953+
954+install-data-local: $(emblem_files)
955+ for size in $(render_sizes); do \
956+ for file in $(emblem_files); do \
957+ $(mkdir_p) $(DESTDIR)$(emblemthemedir)/$$size/emblems; \
958+ $(install_sh_DATA) $(builddir)/$$file $(DESTDIR)$(emblemthemedir)/$$size/emblems/$$file; \
959+ done; \
960+ done
961+
962+uninstall-local:
963+ for size in $(render_sizes); do \
964+ for file in $(emblem_files); do \
965+ rm -f $(DESTDIR)$(emblemthemedir)/$$size/emblems/$$file; \
966+ done; \
967+ done
968+
969+maintainer-clean-local:
970+ rm -rf icons
971+
972+EXTRA_DIST = \
973+ $(desktop_in_files) \
974+ $(service_in_files) \
975+ $(emblem_in_files) \
976+ $(icon_in_files) \
977+ $(icon_cache) \
978+ $(config_DATA) \
979+ oauth_registration.d
980+
981+CLEANFILES = \
982+ $(desktop_DATA) \
983+ $(service_DATA) \
984+ $(emblem_files) \
985+ hicolor
986+
987+MAINTAINERCLEANFILES = \
988+ Makefile.in \
989+ $(icon_cache)
990
991=== renamed file 'data/com.ubuntuone.Authentication.service' => 'data/com.ubuntuone.Authentication.service.in'
992--- data/com.ubuntuone.Authentication.service 2009-05-12 13:36:05 +0000
993+++ data/com.ubuntuone.Authentication.service.in 2009-06-17 16:08:17 +0000
994@@ -1,3 +1,3 @@
995 [D-BUS Service]
996 Name=com.ubuntuone.Authentication
997-Exec=/usr/bin/ubuntuone-client-applet
998+Exec=@bindir@/ubuntuone-client-applet
999
1000=== renamed file 'data/com.ubuntuone.SyncDaemon.service' => 'data/com.ubuntuone.SyncDaemon.service.in'
1001--- data/com.ubuntuone.SyncDaemon.service 2009-05-12 13:36:05 +0000
1002+++ data/com.ubuntuone.SyncDaemon.service.in 2009-06-17 16:08:17 +0000
1003@@ -1,4 +1,4 @@
1004 [D-BUS Service]
1005 Name=com.ubuntuone.SyncDaemon
1006-Exec=/usr/bin/ubuntuone-syncdaemon
1007+Exec=@libexecdir@/ubuntuone-syncdaemon
1008
1009
1010=== renamed directory 'oauth_registration.d' => 'data/oauth_registration.d'
1011=== modified file 'debian/changelog'
1012--- debian/changelog 2009-05-13 18:19:40 +0000
1013+++ debian/changelog 2009-06-17 16:46:42 +0000
1014@@ -1,3 +1,9 @@
1015+ubuntuone-client (0.90.2-0) jaunty; urgency=low
1016+
1017+ * New upstream release
1018+
1019+ -- Rodney Dawes <rodney.dawes@canonical.com> Wed, 17 Jun 2009 12:18:54 -0400
1020+
1021 ubuntuone-client (0.90.1-0) jaunty; urgency=low
1022
1023 * Fix the icon cache issue
1024
1025=== modified file 'debian/control'
1026--- debian/control 2009-06-10 19:03:10 +0000
1027+++ debian/control 2009-06-17 16:46:42 +0000
1028@@ -5,17 +5,23 @@
1029 Maintainer: Rick McBride <rick.mcbride@canonical.com>
1030 Build-Depends: debhelper (>= 5),
1031 cdbs,
1032+ autotools-dev,
1033 python-central,
1034 python-all-dev,
1035+ intltool,
1036 icontool,
1037+ pkg-config,
1038 inkscape,
1039- libxml-simple-perl,
1040- python-distutils-extra
1041-Standards-Version: 3.8.0
1042+ python-distutils-extra,
1043+ libdbus-glib-1-dev,
1044+ libsoup2.4-dev,
1045+ libnautilus-extension-dev,
1046+ xutils-dev
1047+Standards-Version: 3.8.1
1048 Homepage: https://ubuntuone.com
1049
1050 Package: ubuntuone-client
1051-Architecture: all
1052+Architecture: any
1053 XB-Python-Version: ${python:Versions}
1054 Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends},
1055 python-pycurl,
1056@@ -30,8 +36,7 @@
1057 python-pyinotify,
1058 python-notify,
1059 python-apport,
1060- python-twisted-names,
1061- python-nautilus
1062+ python-twisted-names
1063 Provides: ${python:Provides}
1064 Replaces: ubuntuone-oauth-login, nautilus-ubuntuone, ubuntuone-storagefs
1065 Conflicts: ubuntuone-oauth-login, nautilus-ubuntuone, ubuntuone-storagefs
1066
1067=== modified file 'debian/rules'
1068--- debian/rules 2009-05-15 14:18:30 +0000
1069+++ debian/rules 2009-06-17 16:46:42 +0000
1070@@ -1,8 +1,14 @@
1071 #!/usr/bin/make -f
1072
1073+DEB_PYTHON_SYSTEM = pycentral
1074+
1075 include /usr/share/cdbs/1/rules/debhelper.mk
1076-DEB_PYTHON_SYSTEM = pycentral
1077 include /usr/share/cdbs/1/class/python-distutils.mk
1078-
1079-binary-install/ubuntuone-client::
1080- dh_icons -pubuntuone-client
1081+include /usr/share/cdbs/1/rules/utils.mk
1082+include /usr/share/cdbs/1/class/autotools.mk
1083+include /usr/share/cdbs/1/class/gnome.mk
1084+
1085+binary-post-install/ubuntuone-client::
1086+ find debian/ubuntuone-client/usr/lib -name \*.la -exec rm {} \;
1087+ find debian/ubuntuone-client/usr/lib -name \*.a -exec rm {} \;
1088+
1089
1090=== removed file 'nautilus/ubuntuone.py'
1091--- nautilus/ubuntuone.py 2009-05-12 13:36:05 +0000
1092+++ nautilus/ubuntuone.py 1970-01-01 00:00:00 +0000
1093@@ -1,24 +0,0 @@
1094-# ubuntuone.py - Nautilus extensions for Ubuntu One
1095-#
1096-# Author: Tim Cole <tim.cole@canonical.com>
1097-#
1098-# Copyright 2009 Canonical Ltd.
1099-#
1100-# This program is free software: you can redistribute it and/or modify it
1101-# under the terms of the GNU General Public License version 3, as published
1102-# by the Free Software Foundation.
1103-#
1104-# This program is distributed in the hope that it will be useful, but
1105-# WITHOUT ANY WARRANTY; without even the implied warranties of
1106-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1107-# PURPOSE. See the GNU General Public License for more details.
1108-#
1109-# You should have received a copy of the GNU General Public License along
1110-# with this program. If not, see <http://www.gnu.org/licenses/>.
1111-
1112-"""Top-level extension script for Nautilus. Imports extension classes
1113-from extension modules."""
1114-
1115-# pylint: disable-msg=W0611
1116-from canonical.ubuntuone.nautilus.storage import StorageBarProvider, \
1117- StorageInfoProvider, StorageMenuProvider
1118
1119=== modified file 'po/POTFILES.in'
1120--- po/POTFILES.in 2009-05-13 14:21:08 +0000
1121+++ po/POTFILES.in 2009-06-17 16:08:17 +0000
1122@@ -1,6 +1,7 @@
1123+bin/ubuntuone-client-applet
1124 data/emblem-ubuntuone-downloading.icon.in
1125 data/emblem-ubuntuone-unsynchronized.icon.in
1126 data/emblem-ubuntuone-uploading.icon.in
1127 data/ubuntuone-client-applet.desktop.in
1128-bin/ubuntuone-client-applet
1129-canonical/ubuntuone/nautilus/storage.py
1130+nautilus/ubuntuone-nautilus.c
1131+
1132
1133=== added file 'po/POTFILES.skip'
1134--- po/POTFILES.skip 1970-01-01 00:00:00 +0000
1135+++ po/POTFILES.skip 2009-06-17 16:08:17 +0000
1136@@ -0,0 +1,2 @@
1137+contrib/mocker.py
1138+
1139
1140=== modified file 'setup.cfg'
1141--- setup.cfg 2009-05-12 13:36:05 +0000
1142+++ setup.cfg 2009-06-17 16:08:17 +0000
1143@@ -3,24 +3,8 @@
1144 # theme implementation requires the .icon files to be in the same size as
1145 # the loaded icon. Therefore we have to install the same file to all the
1146 # different sizes, so that our translations show up in the UI properly.
1147-[build_i18n]
1148-domain="ubuntuone-client"
1149-desktop_files=[
1150- ('share/applications', ['data/ubuntuone-client-applet.desktop.in']),
1151- ('share/icons/hicolor/48x48/emblems',
1152- ['data/emblem-ubuntuone-downloading.icon.in',
1153- 'data/emblem-ubuntuone-unsynchronized.icon.in',
1154- 'data/emblem-ubuntuone-uploading.icon.in']),
1155- ('share/icons/hicolor/32x32/emblems',
1156- ['data/emblem-ubuntuone-downloading.icon.in',
1157- 'data/emblem-ubuntuone-unsynchronized.icon.in',
1158- 'data/emblem-ubuntuone-uploading.icon.in']),
1159- ('share/icons/hicolor/24x24/emblems',
1160- ['data/emblem-ubuntuone-downloading.icon.in',
1161- 'data/emblem-ubuntuone-unsynchronized.icon.in',
1162- 'data/emblem-ubuntuone-uploading.icon.in']),
1163- ('share/icons/hicolor/16x16/emblems',
1164- ['data/emblem-ubuntuone-downloading.icon.in',
1165- 'data/emblem-ubuntuone-unsynchronized.icon.in',
1166- 'data/emblem-ubuntuone-uploading.icon.in'])
1167- ]
1168+[check]
1169+exclude-files=[
1170+ 'contrib/build_icons.py',
1171+ 'contrib/check.py',
1172+ 'contrib/mocker.py']
1173
1174=== renamed file 'setup.py' => 'setup.py.in' (properties changed: +x to -x)
1175--- setup.py 2009-05-15 21:11:04 +0000
1176+++ setup.py.in 2009-06-17 16:08:17 +0000
1177@@ -3,93 +3,13 @@
1178
1179 import os, sys
1180 from distutils.core import setup, Command
1181-from distutils.spawn import find_executable
1182+from distutils.command import clean
1183 # pylint: disable-msg=F0401
1184-from DistUtilsExtra.command import (build_extra,
1185- build_i18n, clean_i18n)
1186+from DistUtilsExtra.command import build_extra
1187 from contrib import build_icons, check
1188
1189 import subprocess
1190
1191-class NotFoundError(Exception):
1192- """Failed to find the program in the path."""
1193- pass
1194-
1195-class RenderFailed(Exception):
1196- """Failed to render the icons with icontool."""
1197- pass
1198-
1199-class DBusLaunchError(Exception):
1200- """Failed to launch our dbus session daemon."""
1201- pass
1202-
1203-class UbuntuOneBuild(build_extra.build_extra):
1204- """Class to build our stuff."""
1205-
1206- description = "generate our icons and some other things"
1207-
1208- user_options = [("protocol-source=", None,
1209- "path to ubuntuone-storage-protocol source tree")
1210- ] + build_extra.build_extra.user_options
1211-
1212- def initialize_options(self):
1213- """Do build-extra options initialization."""
1214- self.protocol_source = None
1215- build_extra.build_extra.initialize_options(self)
1216-
1217- def finalize_options(self):
1218- """Do build-extra options finalization."""
1219- if self.protocol_source is None:
1220- self.protocol_source = "/usr/share/pyshared"
1221- build_extra.build_extra.finalize_options(self)
1222-
1223- def run(self):
1224- """Do the build"""
1225- if not find_executable("icontool-render"):
1226- raise NotFoundError("You need icontool to generate the icons " +
1227- "for Ubuntu One.")
1228-
1229- print "generating icons"
1230- sizes = [ "16x16", "24x24", "32x32", "48x48" ]
1231- icons = [ "data/ubuntuone-icons.svg", "data/ubuntuone-animations.svg" ]
1232-
1233- iconpath = os.path.join("data", "icons")
1234- if not os.path.exists(iconpath):
1235- os.mkdir(iconpath)
1236-
1237- for icon in icons:
1238- for size in sizes:
1239- p = subprocess.Popen(["icontool-render",
1240- "-o", "data/icons",
1241- "-s", size,
1242- icon],
1243- bufsize=4096, stdout=subprocess.PIPE)
1244- built = p.stdout
1245- p.wait()
1246-
1247- if p.returncode != 0:
1248- raise RenderFailed("Failed to render icons")
1249-
1250- hicolor = os.path.join("data", "hicolor")
1251- if not os.path.exists(hicolor):
1252- os.symlink("icons", hicolor)
1253-
1254- localprotocol = os.path.join("canonical", "ubuntuone",
1255- "storage", "protocol")
1256- if not os.path.exists(localprotocol):
1257- protopath = os.path.join(self.protocol_source, localprotocol)
1258- try:
1259- os.symlink(protopath, localprotocol)
1260- except (IOError, os.error), e:
1261- if hasattr(e, 'filename') and e.filename:
1262- print "%s: %s" % (e.filename, e.strerror)
1263- else:
1264- print "%s: %s" % (localprotocol, e.strerror)
1265-
1266-
1267- build_extra.build_extra.run(self)
1268-
1269-
1270 class UbuntuOneBuildu1fsfsm(Command):
1271 """Class to build u1fsfsm.py from the ods file."""
1272
1273@@ -131,81 +51,15 @@
1274 sys.stderr.write("[ERROR] Failed to build u1fsfsm.py.\n")
1275 sys.exit(1)
1276
1277-
1278-class UbuntuOneClean(clean_i18n.clean_i18n):
1279- """Class to clean up after ourselves."""
1280-
1281- description = "clean up built files"
1282-
1283- def run(self):
1284- """Do the cleanup"""
1285- hicolor = os.path.join("data", "hicolor")
1286- if os.path.exists(hicolor):
1287- os.unlink(hicolor)
1288-
1289- iconpath = os.path.join("data", "icons")
1290- subprocess.call(["rm", "-rf", iconpath])
1291-
1292- protocol = os.path.join("canonical", "ubuntuone",
1293- "storage", "protocol")
1294- if os.path.exists(protocol):
1295- os.unlink(protocol)
1296-
1297- clean_i18n.clean_i18n.run(self)
1298-
1299-
1300-class UbuntuOneCheck(check.check):
1301- """Class to run unit tests and lint checks."""
1302-
1303- description = "validate code with pylint and unit tests"
1304-
1305- def run(self):
1306- """Do the checks."""
1307- check.check.run(self)
1308-
1309- print "\nrunning tests"
1310- returncode = subprocess.call([os.path.join('contrib', 'test')])
1311- if returncode:
1312- sys.exit(returncode)
1313-
1314-
1315 setup(name='ubuntuone-client',
1316- version='0.90.1',
1317-
1318- packages=['canonical.ubuntuone.oauthdesktop',
1319- 'canonical.ubuntuone.nautilus',
1320- 'canonical.ubuntuone.storage.syncdaemon',
1321- 'canonical.ubuntuone.storage.u1sync',
1322- 'canonical.ubuntuone.storage.syncdaemon.fsm'],
1323-
1324- scripts=['bin/ubuntuone-client-applet',
1325- 'bin/ubuntuone-syncdaemon',
1326- 'bin/u1sync',
1327- 'bin/u1sdtool'],
1328-
1329- data_files=[('share/dbus-1/services',
1330- ['data/com.ubuntuone.Authentication.service',
1331- 'data/com.ubuntuone.SyncDaemon.service']),
1332- ('/etc/xdg/ubuntuone',
1333- ['data/oauth_urls', 'data/syncdaemon.conf']),
1334- ('/etc/xdg/ubuntuone/oauth_registration.d',
1335- ['oauth_registration.d/ubuntuone']),
1336- ('lib/nautilus/extensions-2.0/python',
1337- ['nautilus/ubuntuone.py']),
1338- ('share/apport/package-hooks',
1339- ['apport/source_ubuntuone-client.py']),
1340- ('share/man/man1',
1341- ['docs/man/u1sdtool.1',
1342- 'docs/man/u1sync.1',
1343- 'docs/man/ubuntuone-client-applet.1']),
1344- ],
1345+ version = '@VERSION@',
1346+
1347+ data_files = [],
1348
1349 cmdclass = {
1350- 'build' : UbuntuOneBuild,
1351- 'build_i18n' : build_i18n.build_i18n,
1352+ 'build' : build_extra.build_extra,
1353 'build_icons' : build_icons.build_icons,
1354- 'clean' : UbuntuOneClean,
1355- 'check' : UbuntuOneCheck,
1356+ 'check' : check.check,
1357 'build_u1fsfsm' : UbuntuOneBuildu1fsfsm,
1358 }
1359 )
1360
1361=== removed directory 'tests/nautilus'
1362=== removed file 'tests/nautilus/__init__.py'
1363--- tests/nautilus/__init__.py 2009-05-12 13:36:05 +0000
1364+++ tests/nautilus/__init__.py 1970-01-01 00:00:00 +0000
1365@@ -1,14 +0,0 @@
1366-# Copyright 2009 Canonical Ltd.
1367-#
1368-# This program is free software: you can redistribute it and/or modify it
1369-# under the terms of the GNU General Public License version 3, as published
1370-# by the Free Software Foundation.
1371-#
1372-# This program is distributed in the hope that it will be useful, but
1373-# WITHOUT ANY WARRANTY; without even the implied warranties of
1374-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1375-# PURPOSE. See the GNU General Public License for more details.
1376-#
1377-# You should have received a copy of the GNU General Public License along
1378-# with this program. If not, see <http://www.gnu.org/licenses/>.
1379-"""Tests for the nautilus extension."""
1380
1381=== removed file 'tests/nautilus/test_storage.py'
1382--- tests/nautilus/test_storage.py 2009-05-12 13:36:05 +0000
1383+++ tests/nautilus/test_storage.py 1970-01-01 00:00:00 +0000
1384@@ -1,70 +0,0 @@
1385-# canonical.ubuntuone.nautilus.tests.test_storage
1386-#
1387-# Author: Tim Cole <tim.cole@canonical.com>
1388-#
1389-# Copyright 2009 Canonical Ltd.
1390-#
1391-# This program is free software: you can redistribute it and/or modify it
1392-# under the terms of the GNU General Public License version 3, as published
1393-# by the Free Software Foundation.
1394-#
1395-# This program is distributed in the hope that it will be useful, but
1396-# WITHOUT ANY WARRANTY; without even the implied warranties of
1397-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1398-# PURPOSE. See the GNU General Public License for more details.
1399-#
1400-# You should have received a copy of the GNU General Public License along
1401-# with this program. If not, see <http://www.gnu.org/licenses/>.
1402-"""Tests for the storage-related nautilus extension classes."""
1403-
1404-from __future__ import with_statement
1405-from unittest import TestCase
1406-from canonical.ubuntuone.nautilus.storage import StorageBarProvider
1407-from contrib.mocker import Mocker, expect
1408-
1409-
1410-class TestStorageBarProvider(TestCase):
1411- """Test the Storage location bar provider."""
1412-
1413- def setUp(self):
1414- """Sets up the test."""
1415- self.mocker = Mocker()
1416- self.window = self.mocker.mock()
1417- self.storagefs_test = self.mocker.mock()
1418- self.provider = None
1419-
1420- def tearDown(self):
1421- """Tears down a test."""
1422- self.mocker.restore()
1423- self.mocker.verify()
1424-
1425- def replay(self):
1426- """Starts replay phase and creates the storage bar provider."""
1427- self.mocker.replay()
1428- self.provider = StorageBarProvider(is_storagefs=self.storagefs_test)
1429-
1430- def testInstantiation(self):
1431- """Make sure that instantiation works."""
1432- self.replay()
1433-
1434- def testNoWidgetForNonFileURIs(self):
1435- """Make sure that we don't return a widget for non-file URIs."""
1436- url = "http://www.google.com/"
1437- self.replay()
1438- self.assert_(self.provider.get_widget(url, self.window) is None,
1439- "Should not return a widget for a non-file URI")
1440-
1441- def testNoWidgetOutsideStorageFS(self):
1442- """Make sure that we don't return a widget for regular directories."""
1443- url = "file:///etc/"
1444- expect(self.storagefs_test("/etc/")).result(False)
1445- self.replay()
1446- self.assert_(self.provider.get_widget(url, self.window) is None,
1447- "Should not return a widget outside storagefs")
1448-
1449- def testWidgetInsideStorageFS(self):
1450- """Make sure that we do return a widget for storagefs directories."""
1451- url = "file:///blah/"
1452- expect(self.storagefs_test("/blah/")).result(True)
1453- self.replay()
1454- self.assert_(self.provider.get_widget(url, self.window) is not None)

Subscribers

People subscribed via source and target branches