Merge lp:~mandel/ubuntuone-windows-installer/fix-vista-update into lp:ubuntuone-windows-installer

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 91
Merged at revision: 91
Proposed branch: lp:~mandel/ubuntuone-windows-installer/fix-vista-update
Merge into: lp:ubuntuone-windows-installer
Diff against target: 82 lines (+49/-4)
2 files modified
ubuntuone_installer/gui/qt/utils/tests/test_windows.py (+43/-2)
ubuntuone_installer/gui/qt/utils/windows.py (+6/-2)
To merge this branch: bzr merge lp:~mandel/ubuntuone-windows-installer/fix-vista-update
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+82418@code.launchpad.net

Commit message

Fixes the code that will call the autoupdate-windows.exe. The idea is that in the release the .exe will be in a diff location to avoid dll collisions.

Description of the change

Fixes the code that will call the autoupdate-windows.exe. The idea is that in the release the .exe will be in a diff location to avoid dll collisions.

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

+1 code review

review: Approve
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1 looks fine

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone_installer/gui/qt/utils/tests/test_windows.py'
2--- ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-11-11 19:27:39 +0000
3+++ ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-11-16 15:56:23 +0000
4@@ -527,8 +527,49 @@
5 self.assertEqual('', self._called[0][4])
6 self.assertEqual(0, self._called[0][5])
7
8- def test_get_auto_update_path(self):
9- """Test the method used to get the autoupdate."""
10+
11+class UpdatePathTestCase(BaseTestCase):
12+ """Test getting the update path."""
13+
14+ @defer.inlineCallbacks
15+ def setUp(self):
16+ """Set the different tests."""
17+ yield super(UpdatePathTestCase, self).setUp()
18+ self.module_path = os.path.join('.', 'root', 'exe', 'dist')
19+ self.module_path = os.path.abspath(self.module_path)
20+ self.patch(os.path, 'exists', lambda *args: True)
21+
22+ def _clean_file(self, module, path):
23+ """Set back the correct path."""
24+ module.__file__ = path
25+
26+ def _clean_frozen(self, old_executable):
27+ """Set back not to be frozen."""
28+ del sys.frozen
29+ sys.executable = old_executable
30+
31+ def test_get_update_path_not_frozen(self):
32+ """Test we return the path to levels up to the dist."""
33+ old_utils_path = utils.windows.__file__
34+ utils.windows.__file__ = os.path.join(self.module_path, 'windows.py')
35+ self.addCleanup(self._clean_file, utils.windows, old_utils_path)
36+ expected_path = os.path.join('root',
37+ utils.windows.AUTO_UPDATE_EXE)
38+ expected_path = os.path.abspath(expected_path)
39+ path = utils.windows._get_update_path()
40+ self.assertEqual(expected_path, path)
41+
42+ def test_get_update_path_frozen(self):
43+ """Test we return the path to levels up to the dist."""
44+ sys.frozen = True
45+ old_exe = sys.executable
46+ sys.executable = os.path.join(self.module_path, 'ubuntuone.exe')
47+ self.addCleanup(self._clean_frozen, old_exe)
48+ expected_path = os.path.join('root', 'exe',
49+ utils.windows.AUTO_UPDATE_EXE)
50+ expected_path = os.path.abspath(expected_path)
51+ path = utils.windows._get_update_path()
52+ self.assertEqual(expected_path, path)
53
54
55 class CheckUpdatesTestCase(BaseTestCase):
56
57=== modified file 'ubuntuone_installer/gui/qt/utils/windows.py'
58--- ubuntuone_installer/gui/qt/utils/windows.py 2011-11-11 19:27:39 +0000
59+++ ubuntuone_installer/gui/qt/utils/windows.py 2011-11-16 15:56:23 +0000
60@@ -67,7 +67,7 @@
61 # LONG_PATH_PREFIX will always be appended only to windows paths,
62 # which should always be unicode.
63 LONG_PATH_PREFIX = u'\\\\?\\'
64-
65+AUTO_UPDATE_EXE = 'autoupdate-windows.exe'
66
67 class MsiException(Exception):
68 """Raised when there are msi issues."""
69@@ -97,8 +97,12 @@
70 exec_path = os.path.abspath(sys.executable)
71 else:
72 exec_path = os.path.dirname(__file__)
73+ # we take as an axiom that the python code is present in a dist
74+ # folder (whatever the path is) and that the autoupdate is
75+ # present in a level above it
76+ exec_path = os.path.dirname(exec_path)
77 folder = os.path.dirname(exec_path)
78- update_path = os.path.join(folder, "autoupdate-windows.exe")
79+ update_path = os.path.join(folder, AUTO_UPDATE_EXE)
80 if os.path.exists(update_path):
81 return update_path
82 return None

Subscribers

People subscribed via source and target branches