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
=== modified file 'ubuntuone_installer/gui/qt/utils/tests/test_windows.py'
--- ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-11-11 19:27:39 +0000
+++ ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-11-16 15:56:23 +0000
@@ -527,8 +527,49 @@
527 self.assertEqual('', self._called[0][4])527 self.assertEqual('', self._called[0][4])
528 self.assertEqual(0, self._called[0][5])528 self.assertEqual(0, self._called[0][5])
529529
530 def test_get_auto_update_path(self):530
531 """Test the method used to get the autoupdate."""531class UpdatePathTestCase(BaseTestCase):
532 """Test getting the update path."""
533
534 @defer.inlineCallbacks
535 def setUp(self):
536 """Set the different tests."""
537 yield super(UpdatePathTestCase, self).setUp()
538 self.module_path = os.path.join('.', 'root', 'exe', 'dist')
539 self.module_path = os.path.abspath(self.module_path)
540 self.patch(os.path, 'exists', lambda *args: True)
541
542 def _clean_file(self, module, path):
543 """Set back the correct path."""
544 module.__file__ = path
545
546 def _clean_frozen(self, old_executable):
547 """Set back not to be frozen."""
548 del sys.frozen
549 sys.executable = old_executable
550
551 def test_get_update_path_not_frozen(self):
552 """Test we return the path to levels up to the dist."""
553 old_utils_path = utils.windows.__file__
554 utils.windows.__file__ = os.path.join(self.module_path, 'windows.py')
555 self.addCleanup(self._clean_file, utils.windows, old_utils_path)
556 expected_path = os.path.join('root',
557 utils.windows.AUTO_UPDATE_EXE)
558 expected_path = os.path.abspath(expected_path)
559 path = utils.windows._get_update_path()
560 self.assertEqual(expected_path, path)
561
562 def test_get_update_path_frozen(self):
563 """Test we return the path to levels up to the dist."""
564 sys.frozen = True
565 old_exe = sys.executable
566 sys.executable = os.path.join(self.module_path, 'ubuntuone.exe')
567 self.addCleanup(self._clean_frozen, old_exe)
568 expected_path = os.path.join('root', 'exe',
569 utils.windows.AUTO_UPDATE_EXE)
570 expected_path = os.path.abspath(expected_path)
571 path = utils.windows._get_update_path()
572 self.assertEqual(expected_path, path)
532573
533574
534class CheckUpdatesTestCase(BaseTestCase):575class CheckUpdatesTestCase(BaseTestCase):
535576
=== modified file 'ubuntuone_installer/gui/qt/utils/windows.py'
--- ubuntuone_installer/gui/qt/utils/windows.py 2011-11-11 19:27:39 +0000
+++ ubuntuone_installer/gui/qt/utils/windows.py 2011-11-16 15:56:23 +0000
@@ -67,7 +67,7 @@
67# LONG_PATH_PREFIX will always be appended only to windows paths,67# LONG_PATH_PREFIX will always be appended only to windows paths,
68# which should always be unicode.68# which should always be unicode.
69LONG_PATH_PREFIX = u'\\\\?\\'69LONG_PATH_PREFIX = u'\\\\?\\'
7070AUTO_UPDATE_EXE = 'autoupdate-windows.exe'
7171
72class MsiException(Exception):72class MsiException(Exception):
73 """Raised when there are msi issues."""73 """Raised when there are msi issues."""
@@ -97,8 +97,12 @@
97 exec_path = os.path.abspath(sys.executable)97 exec_path = os.path.abspath(sys.executable)
98 else:98 else:
99 exec_path = os.path.dirname(__file__)99 exec_path = os.path.dirname(__file__)
100 # we take as an axiom that the python code is present in a dist
101 # folder (whatever the path is) and that the autoupdate is
102 # present in a level above it
103 exec_path = os.path.dirname(exec_path)
100 folder = os.path.dirname(exec_path)104 folder = os.path.dirname(exec_path)
101 update_path = os.path.join(folder, "autoupdate-windows.exe")105 update_path = os.path.join(folder, AUTO_UPDATE_EXE)
102 if os.path.exists(update_path):106 if os.path.exists(update_path):
103 return update_path107 return update_path
104 return None108 return None

Subscribers

People subscribed via source and target branches