Merge lp:~statik/desktopcouch/no-ubuntuone-imports into lp:desktopcouch

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

Commit message

clean up some import failures when ubuntuone-client is not installed.

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

when desktopcouch is installed and none of the ubuntuone-client packages are installed, desktopcouch fails to import. it should not do that, and this branch fixes the problem.

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

Looks good

review: Approve
Revision history for this message
Rodrigo Moya (rodrigo-moya) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/local_files.py'
2--- desktopcouch/local_files.py 2009-08-03 14:26:13 +0000
3+++ desktopcouch/local_files.py 2009-08-05 11:18:46 +0000
4@@ -24,7 +24,6 @@
5 import os
6 import xdg.BaseDirectory
7 import subprocess
8-import ubuntuone
9
10
11 def mkpath(rootdir, path):
12@@ -34,6 +33,10 @@
13 def u1_is_in_source_tree():
14 """If the parent dir of the module directory is "lib", and there is
15 a "tmp" dir and a "README" file, then the u1 code is in a source tree."""
16+ try:
17+ import ubuntuone
18+ except ImportError:
19+ return False
20 u1mod_dir, u1mod_file = os.path.split(ubuntuone.__file__)
21 if u1mod_dir.split(os.sep)[-2] != "lib":
22 return False
23@@ -46,10 +49,10 @@
24 return False
25
26 return True
27-
28
29
30 if u1_is_in_source_tree():
31+ import ubuntuone
32 rootdir = os.path.join(os.path.split(ubuntuone.__file__)[0], "..", "..", "tmp")
33 FILE_INI = mkpath(rootdir, "desktop-couchdb.ini")
34 DIR_DB = mkpath(rootdir, "desktop-couch-files")
35
36=== modified file 'desktopcouch/records/record.py'
37--- desktopcouch/records/record.py 2009-07-08 17:48:11 +0000
38+++ desktopcouch/records/record.py 2009-08-05 11:18:46 +0000
39@@ -21,11 +21,7 @@
40 """A dictionary based record representation."""
41
42 import re
43-
44-try:
45- from ubuntuone.contrib import uuid
46-except ImportError:
47- import uuid
48+import uuid
49
50 RX = re.compile('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')
51

Subscribers

People subscribed via source and target branches