Merge lp:~mandel/ubuntu-sso-client/darwin-ac-cmdline into lp:ubuntu-sso-client

Proposed by Manuel de la Peña on 2012-05-21
Status: Merged
Approved by: Manuel de la Peña on 2012-05-21
Approved revision: 960
Merged at revision: 957
Proposed branch: lp:~mandel/ubuntu-sso-client/darwin-ac-cmdline
Merge into: lp:ubuntu-sso-client
Diff against target: 64 lines (+19/-14)
2 files modified
ubuntu_sso/main/__init__.py (+3/-0)
ubuntu_sso/main/darwin.py (+16/-14)
To merge this branch: bzr merge lp:~mandel/ubuntu-sso-client/darwin-ac-cmdline
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve on 2012-05-21
Roberto Alsina (community) 2012-05-21 Approve on 2012-05-21
Review via email: mp+106635@code.launchpad.net

Commit Message

- Moved the code out to a function so that it can be called from other projects (LP: #1002307).

Description of the Change

- Moved the code out to a function so that it can be called from other projects (LP: #1002307).

To post a comment you must log in.
959. By Manuel de la Peña on 2012-05-21

Allow the function to be accessed at package modue. Use name not self.name

Roberto Alsina (ralsina) :
review: Approve
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
960. By Manuel de la Peña on 2012-05-21

Fix typo in comment.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/main/__init__.py'
2--- ubuntu_sso/main/__init__.py 2012-05-18 14:25:49 +0000
3+++ ubuntu_sso/main/__init__.py 2012-05-21 14:41:25 +0000
4@@ -94,9 +94,12 @@
5 else:
6 from ubuntu_sso.main import linux as source
7
8+ source.get_activation_cmdline = lambda *args: None
9+
10 UbuntuSSOClient = source.UbuntuSSOClient
11 UbuntuSSOProxy = source.UbuntuSSOProxy
12 get_sso_client = source.get_sso_client
13+get_activation_cmdline = source.get_activation_cmdline
14
15
16 def except_to_errdict(e):
17
18=== modified file 'ubuntu_sso/main/darwin.py'
19--- ubuntu_sso/main/darwin.py 2012-04-30 17:59:19 +0000
20+++ ubuntu_sso/main/darwin.py 2012-05-21 14:41:25 +0000
21@@ -55,6 +55,21 @@
22 return path
23
24
25+def get_activation_cmdline(name):
26+ """Find the path to the executable callback."""
27+ # TODO: We have to either use launchd to launch the different services
28+ # on demand or us LaunchServices to handle running the app via an URL.
29+ ubuntu_sso_pkg_dir = os.path.dirname(os.path.dirname(ubuntu_sso.__file__))
30+ ubuntu_sso_bin_dir = os.path.join(ubuntu_sso_pkg_dir, 'bin')
31+ ubuntu_sso_bin = os.path.join(ubuntu_sso_bin_dir, 'ubuntu-sso-login')
32+ ubuntuone_client_bin_dir = os.path.join(ubuntu_sso_pkg_dir,
33+ '../ubuntuone-client/bin')
34+ ubuntuone_client_bin = os.path.join(ubuntuone_client_bin_dir, name)
35+ if os.path.exists(ubuntuone_client_bin):
36+ return ubuntuone_client_bin
37+ return ubuntu_sso_bin
38+
39+
40 class DescriptionFactory(object):
41 """Factory that provides the server and client descriptions."""
42
43@@ -81,20 +96,7 @@
44 @property
45 def cmdline(self):
46 """Get the command line to activate an executable."""
47- # MAYBE: use special URI schemes to have LaunchServices handle
48- # running the app, instead of paths to scripts
49- # e.g. 'x-ubuntuone-syncdaemon', 'x-ubuntu-sso-login'
50- ubuntu_sso_pkg_dir = os.path.dirname(
51- os.path.dirname(ubuntu_sso.__file__))
52- ubuntu_sso_bin_dir = os.path.join(ubuntu_sso_pkg_dir, 'bin')
53- ubuntu_sso_bin = os.path.join(ubuntu_sso_bin_dir, 'ubuntu-sso-login')
54- ubuntuone_client_bin_dir = os.path.join(ubuntu_sso_pkg_dir,
55- '../ubuntuone-client/bin')
56- ubuntuone_client_bin = os.path.join(ubuntuone_client_bin_dir,
57- self.name)
58- if os.path.exists(ubuntuone_client_bin):
59- return ubuntuone_client_bin
60- return ubuntu_sso_bin
61+ return get_activation_cmdline(self.name)
62
63
64 class UbuntuSSOClient(BaseClient):

Subscribers

People subscribed via source and target branches