Merge lp:~ralsina/ubuntu-sso-client/find_exes into lp:ubuntu-sso-client

Proposed by Roberto Alsina on 2012-03-18
Status: Merged
Approved by: Roberto Alsina on 2012-03-19
Approved revision: 924
Merged at revision: 925
Proposed branch: lp:~ralsina/ubuntu-sso-client/find_exes
Merge into: lp:ubuntu-sso-client
Diff against target: 40 lines (+11/-4)
2 files modified
ubuntu_sso/__init__.py (+6/-0)
ubuntu_sso/utils/__init__.py (+5/-4)
To merge this branch: bzr merge lp:~ralsina/ubuntu-sso-client/find_exes
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) 2012-03-18 Approve on 2012-03-19
Natalia Bidart Approve on 2012-03-19
Brian Curtin (community) Approve on 2012-03-19
Review via email: mp+98108@code.launchpad.net

Commit message

- Added .exe to the constant for binary names if needed (LP: #958778)

Description of the change

fix paths and spawning on windows

To post a comment you must log in.
Manuel de la Peña (mandel) wrote :

We should add tests fit this since we already had problems with get_bin due to the lack of tests. What about patching sys.platform and test the result?

Also, I think I'd a good idea to set the gtk one to none on windows to make the error more clear.

review: Needs Fixing
Roberto Alsina (ralsina) wrote :

> We should add tests fit this since we already had problems with get_bin due to
> the lack of tests. What about patching sys.platform and test the result?
>
> Also, I think I'd a good idea to set the gtk one to none on windows to make
> the error more clear.

This already had tests, I added them in a branch on friday.

The only functional change in this branch are the constants for binary names, the other is just a cosmetic fix.

Natalia Bidart (nataliabidart) wrote :

Looks good! Though I'm getting:

ubuntu_sso/__init__.py:
    42: [W0311] Bad indentation. Found 3 spaces, expected 4
    43: [W0311] Bad indentation. Found 3 spaces, expected 4

review: Needs Fixing
Roberto Alsina (ralsina) wrote :

> Looks good! Though I'm getting:
>
> ubuntu_sso/__init__.py:
> 42: [W0311] Bad indentation. Found 3 spaces, expected 4
> 43: [W0311] Bad indentation. Found 3 spaces, expected 4

Fixed in revno924, thanks!

924. By Roberto Alsina on 2012-03-19

pep8 fix

Brian Curtin (brian.curtin) wrote :

looks good

review: Approve
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/__init__.py'
2--- ubuntu_sso/__init__.py 2012-03-08 12:35:25 +0000
3+++ ubuntu_sso/__init__.py 2012-03-19 14:18:18 +0000
4@@ -15,6 +15,8 @@
5 # with this program. If not, see <http://www.gnu.org/licenses/>.
6 """Ubuntu Single Sign On client code."""
7
8+import sys
9+
10 # DBus constants
11 DBUS_BUS_NAME = "com.ubuntu.sso"
12
13@@ -35,3 +37,7 @@
14 UI_EXECUTABLE_GTK = 'ubuntu-sso-login-gtk'
15 UI_EXECUTABLE_QT = 'ubuntu-sso-login-qt'
16 UI_PROXY_CREDS_DIALOG = 'ubuntu-sso-proxy-creds-qt'
17+
18+if getattr(sys, "frozen", None) is not None and sys.platform == "win32":
19+ UI_EXECUTABLE_QT += ".exe"
20+ UI_PROXY_CREDS_DIALOG += ".exe"
21
22=== modified file 'ubuntu_sso/utils/__init__.py'
23--- ubuntu_sso/utils/__init__.py 2012-03-16 22:33:29 +0000
24+++ ubuntu_sso/utils/__init__.py 2012-03-19 14:18:18 +0000
25@@ -96,12 +96,13 @@
26 """
27 # If sys is frozen, this is an .exe, and all binaries are in
28 # the same place
29- if hasattr(sys, "frozen"):
30+ if getattr(sys, "frozen", None) is not None:
31 exec_path = os.path.abspath(sys.executable)
32- return os.path.dirname(exec_path)
33-
34- result = _get_dir(dir_name=BIN_SUFFIX, dir_constant='BIN_DIR')
35+ result = os.path.dirname(exec_path)
36+ else:
37+ result = _get_dir(dir_name=BIN_SUFFIX, dir_constant='BIN_DIR')
38 assert result is not None, '%r dir can not be None.' % BIN_SUFFIX
39+ logger.info('get_bin_dir: returning dir located at %r.', result)
40 return result
41
42

Subscribers

People subscribed via source and target branches