Merge lp:~mandel/ubuntuone-windows-installer/put-migration-together into lp:ubuntuone-windows-installer

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 112
Merged at revision: 94
Proposed branch: lp:~mandel/ubuntuone-windows-installer/put-migration-together
Merge into: lp:ubuntuone-windows-installer
Prerequisite: lp:~mandel/ubuntuone-windows-installer/migrate-data
Diff against target: 383 lines (+196/-48)
6 files modified
ubuntuone_installer/gui/qt/gui.py (+44/-9)
ubuntuone_installer/gui/qt/tests/test_gui.py (+105/-34)
ubuntuone_installer/gui/qt/utils/__init__.py (+6/-0)
ubuntuone_installer/gui/qt/utils/tests/test_common.py (+9/-0)
ubuntuone_installer/gui/qt/utils/tests/test_windows.py (+5/-2)
ubuntuone_installer/gui/qt/utils/windows.py (+27/-3)
To merge this branch: bzr merge lp:~mandel/ubuntuone-windows-installer/put-migration-together
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Diego Sarmentero (community) Approve
Review via email: mp+78995@code.launchpad.net

Commit message

Put all the different pieces of the migration together so that we perform the uninstall and migtration of the data if the user has the very old first beta.

Description of the change

Put all the different pieces of the migration together so that we perform the uninstall and migtration of the data if the user has the very old first beta.

To post a comment you must log in.
94. By Manuel de la Peña

Merged with parent.

95. By Manuel de la Peña

Disable lint error.

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

+1

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

This is now having conflicts with trunk:

Text conflict in ubuntuone_installer/gui/qt/main/tests/test_windows.py
Text conflict in ubuntuone_installer/gui/qt/main/windows.py
Text conflict in ubuntuone_installer/gui/qt/utils/__init__.py
Text conflict in ubuntuone_installer/gui/qt/utils/windows.py
4 conflicts encountered.

review: Needs Fixing
96. By Manuel de la Peña

Merged with trunk, fixed conflicts.

97. By Manuel de la Peña

Fixed boken tests after merge.

98. By Manuel de la Peña

Fixed lint and pep8 issues.

99. By Manuel de la Peña

Merged with trunk and fixed conflicts.

100. By Manuel de la Peña

Added new tests for the check_credentials.

101. By Manuel de la Peña

Fixed test and pylint issues.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

* Can you please remove the duplication of titles for REMOVE_OLD_BETA_TITLE and REMOVE_OLD_BETA_ERROR_TITLE? the same for MIGRATE_OLD_BETA_DATA_TITLE and MIGRATE_OLD_BETA_DATA_ERROR_TITLE

* Instead of returning:

    if result == QtGui.QMessageBox.Yes:
        return True
    return False

just do:

    return result == QtGui.QMessageBox.Yes

* Typo: "if there are not credentials"

* Minor fix: in CheckCredentialsTestCase, please move the self.migrate_data_cb definition right before the calling to self.patch(utils, 'perform_old_beta_data_migration', ...), so each fake is close to each patch.

* in ubuntuone_installer/gui/qt/utils/windows.py, the definition of logger is duplicated:

line 48: logger = setup_logging('qt.utils.windows')
line 72: logger = setup_logging('qt.gui.utils.windows')

we should have only one.

* Any reason to expose the UninstallException and DataMigrationException on the utils/__init__ file? they don't seem to be used anywhere.

review: Needs Fixing
102. By Manuel de la Peña

Fixed code following review comments.

103. By Manuel de la Peña

Fixed failing test.

104. By Manuel de la Peña

Use the exception from the correct module.

105. By Manuel de la Peña

Fixed pep8 issue.

106. By Manuel de la Peña

Removed duplicated title.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

I'm getting these lint issues:

ubuntuone_installer/gui/qt/utils/tests/test_windows.py:
    559: [W0212, UpdatePathTestCase.test_get_update_path_not_frozen] Access to a protected member _get_update_path of a client class
    571: [W0212, UpdatePathTestCase.test_get_update_path_frozen] Access to a protected member _get_update_path of a client class

review: Needs Fixing
107. By Manuel de la Peña

Make lint happy.

108. By Manuel de la Peña

Merged with trunk.

109. By Manuel de la Peña

Merged with trunk and fixed pep8 issues after the merge.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Tests won't run due to the parameter ordering, you will also need to apply this change:

=== modified file 'run-tests.bat'
--- run-tests.bat 2011-08-24 17:04:02 +0000
+++ run-tests.bat 2011-11-30 20:07:10 +0000
@@ -66,4 +66,4 @@
 "%PYTHONEXEPATH%\python.exe" setup.py build
 ECHO Running tests
 :: execute the tests with a number of ignored linux only modules
-"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" -i "test_linux.py" ubuntuone_installer --gui --reactor=qt4
+"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" -i "test_linux.py" --gui --reactor=qt4 ubuntuone_installer

review: Needs Fixing
Revision history for this message
Manuel de la Peña (mandel) wrote :

Sig.. sorted it out!

110. By Manuel de la Peña

Change the order of params to make the new ubuntuone-dev-tools happy.

111. By Manuel de la Peña

Merged with trunk and fixed conflict.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good now.

Please, before merging remove the exceptions added to ubuntuone_installer/gui/qt/utils/linux.py, since they are not exported nor used.

Thanks!

review: Approve
112. By Manuel de la Peña

Removed unused exceptions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone_installer/gui/qt/gui.py'
--- ubuntuone_installer/gui/qt/gui.py 2011-11-17 20:05:33 +0000
+++ ubuntuone_installer/gui/qt/gui.py 2011-12-01 14:58:32 +0000
@@ -1,8 +1,4 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2
3# Authors: Alejandro J. Cura <alecu@canonical.com>
4# Roberto Alsina <roberto.alsina@canonical.com>
5# Diego Sarmentero <diego.sarmentero@canonical.com>
6#2#
7# Copyright 2011 Canonical Ltd.3# Copyright 2011 Canonical Ltd.
8#4#
@@ -97,19 +93,58 @@
97UPDATE_TITLE = _("Updates are available")93UPDATE_TITLE = _("Updates are available")
98UPDATE_SOFTWARE = _("There is a new version available. "94UPDATE_SOFTWARE = _("There is a new version available. "
99 "Do you want perform an upgrade?")95 "Do you want perform an upgrade?")
96REMOVE_OLD_BETA_TITLE = _("Remove old Beta")
97REMOVE_OLD_BETA = _("The old Ubuntu One Beta is installed in your system. Do "
98 "you want to uninstall it?")
99REMOVE_OLD_BETA_ERROR = _("There was an error uninstall the old beta. Please "
100 "do this step manually")
101MIGRATE_OLD_BETA_DATA_TITLE = _("Migrate old data")
102MIGRATE_OLD_BETA = _("Do you want to migrate the files from the old Ubuntu "
103 "One Beta location to the new one?")
104MIGRATE_OLD_BETA_DATA_ERROR = _("There was an error migrating your data. "
105 "Please do this step manually.")
106
100# Invalid name logger107# Invalid name logger
101# pylint: disable=C0103108# pylint: disable=C0103
102logger = setup_logging('qt.gui')109logger = setup_logging('qt.gui')
103# pylint: enable=C0103110# pylint: enable=C0103
104111
105112
113def _ask_user_question(title, question):
114 """Ask the user a Yes/No question."""
115 result = QtGui.QMessageBox.question(None, title, question,
116 QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
117 return result == QtGui.QMessageBox.Yes
118
119
106def user_wants_to_update():120def user_wants_to_update():
107 """Ask the user if he really wants to update the software."""121 """Ask the user if he really wants to update the software."""
108 result = QtGui.QMessageBox.question(None, UPDATE_TITLE, UPDATE_SOFTWARE,122 return _ask_user_question(UPDATE_TITLE, UPDATE_SOFTWARE)
109 QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)123
110 if result == QtGui.QMessageBox.Yes:124
111 return True125def user_wants_to_remove_old_beta():
112 return False126 """Ask the user if he really wants to remove the old beta."""
127 return _ask_user_question(REMOVE_OLD_BETA_TITLE, REMOVE_OLD_BETA)
128
129
130def user_wants_to_migrate_data():
131 """Ask the user if he really wants to migrate the data."""
132 return _ask_user_question(MIGRATE_OLD_BETA_DATA_TITLE, MIGRATE_OLD_BETA)
133
134
135def _warn_user(title, message):
136 """Warn the user."""
137 QtGui.QMessageBox.warning(None, title, message, QtGui.QMessageBox.Ok)
138
139
140def warn_user_beta_not_removed():
141 """Let the user know that the data was not migrated."""
142 _warn_user(REMOVE_OLD_BETA_TITLE, REMOVE_OLD_BETA_ERROR)
143
144
145def warn_user_data_not_migrated():
146 """Let the user know that the data was not migrated."""
147 _warn_user(MIGRATE_OLD_BETA_DATA_TITLE, MIGRATE_OLD_BETA_DATA_ERROR)
113148
114149
115class LicensePage(SSOWizardPage):150class LicensePage(SSOWizardPage):
116151
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-11-17 20:13:28 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-12-01 14:58:32 +0000
@@ -729,51 +729,122 @@
729 self.assertTrue(self.ui.ui.existing_account_button.isDefault())729 self.assertTrue(self.ui.ui.existing_account_button.isDefault())
730730
731731
732class UpgradeQuestion(BaseTestCase):732class MessageBoxTestCase(BaseTestCase):
733 """Test the dialog that ask the user if he wants to upgrade."""733 """Test the dialog that ask the user if he wants to upgrade."""
734734
735 @defer.inlineCallbacks735 @defer.inlineCallbacks
736 def setUp(self):736 def setUp(self):
737 """Set the tests."""737 """Set the tests."""
738 yield super(UpgradeQuestion, self).setUp()738 yield super(MessageBoxTestCase, self).setUp()
739 self.answer = 0739 self.answer = 0
740 self.parent = None740 self.parent = None
741 self.title = None741 self.title = None
742 self.text = None742 self.text = None
743 self.yes_button = None743 self.yes_button = None
744 self.no_button = None744 self.no_button = None
745745 self.ok_button = None
746 def fake_question(parent, title, text, yes_button,746
747 no_button):747 class FakeMessageBox(object):
748 """Fake asking a question."""748 """A fake message box."""
749 self.parent = parent749
750 self.title = title750 No = 'No'
751 self.text = text751 Yes = 'Yes'
752 self.yes_button = yes_button752 Ok = 'Ok'
753 self.no_button = no_button753
754 return self.answer754 @classmethod
755755 def question(cls, parent, title, text, yes_button,
756 self.patch(gui.QtGui.QMessageBox, 'question', fake_question)756 no_button):
757757 """Fake asking a question."""
758 def user_wants_to_update_true(self):758 self.parent = parent
759 """Test the question."""759 self.title = title
760 self.text = text
761 self.yes_button = yes_button
762 self.no_button = no_button
763 return self.answer
764
765 @classmethod
766 def warning(cls, parent, title, text, ok_button):
767 """Fake warning the user."""
768 self.parent = parent
769 self.title = title
770 self.text = text
771 self.ok_button = ok_button
772 return self.answer
773
774 self.patch(gui.QtGui, 'QMessageBox', FakeMessageBox)
775
776 def _assert_question(self, question_title, question_text):
777 """Assert the execution of a question."""
778 self.assertEqual(None, self.parent)
779 self.assertEqual(self.title, question_title)
780 self.assertEqual(self.text, question_text)
781 self.assertEqual(self.yes_button, gui.QtGui.QMessageBox.Yes)
782 self.assertEqual(self.no_button, gui.QtGui.QMessageBox.No)
783
784 def _assert_true_question(self, question_fn, question_title,
785 question_text):
786 """Assert a positive answer to a question."""
760 self.answer = gui.QtGui.QMessageBox.Yes787 self.answer = gui.QtGui.QMessageBox.Yes
761 self.assertTrue(gui.user_wants_to_update(), 'User wants to update.')788 self.assertTrue(question_fn())
762 # lets assert the parameters789 self._assert_question(question_title, question_text)
763 self.assertTrue(None, self.parent)
764 self.assertTrue(self.title, gui.UPDATE_TITLE)
765 self.assertTrue(self.text, gui.UPDATE_SOFTWARE)
766 self.assertTrue(self.yes_button, gui.QtGui.QMessageBox.Yes)
767 self.assertTrue(self.no_button, gui.QtGui.QMessageBox.No)
768790
769 def user_wants_to_update_false(self):791 def _assert_false_question(self, question_fn, question_title,
770 """Test the question."""792 question_text):
793 """Assert a negative answer to a question."""
771 self.answer = gui.QtGui.QMessageBox.No794 self.answer = gui.QtGui.QMessageBox.No
772 msg = 'user_wants_to_update must return False when the answer is No.'795 self.assertFalse(question_fn())
773 self.assertFalse(gui.user_wants_to_update(), msg)796 self._assert_question(question_title, question_text)
774 # lets assert the parameters797
775 self.assertTrue(None, self.parent)798 def test_user_wants_to_update_true(self):
776 self.assertTrue(self.title, gui.UPDATE_TITLE)799 """Test the question."""
777 self.assertTrue(self.text, gui.UPDATE_SOFTWARE)800 self._assert_true_question(gui.user_wants_to_update, gui.UPDATE_TITLE,
778 self.assertTrue(self.yes_button, gui.QtGui.QMessageBox.Yes)801 gui.UPDATE_SOFTWARE)
779 self.assertTrue(self.no_button, gui.QtGui.QMessageBox.No)802
803 def test_user_wants_to_update_false(self):
804 """Test the question."""
805 self._assert_false_question(gui.user_wants_to_update, gui.UPDATE_TITLE,
806 gui.UPDATE_SOFTWARE)
807
808 def test_user_wants_to_remove_true(self):
809 """Test the question."""
810 self._assert_true_question(gui.user_wants_to_remove_old_beta,
811 gui.REMOVE_OLD_BETA_TITLE,
812 gui.REMOVE_OLD_BETA)
813
814 def test_user_wants_to_remove_false(self):
815 """Test the question."""
816 self._assert_false_question(gui.user_wants_to_remove_old_beta,
817 gui.REMOVE_OLD_BETA_TITLE,
818 gui.REMOVE_OLD_BETA)
819
820 def test_user_wants_to_migrate_true(self):
821 """Test the question."""
822 self._assert_true_question(gui.user_wants_to_migrate_data,
823 gui.MIGRATE_OLD_BETA_DATA_TITLE,
824 gui.MIGRATE_OLD_BETA)
825
826 def test_user_wants_to_migrate_false(self):
827 """Test the question."""
828 self._assert_false_question(gui.user_wants_to_migrate_data,
829 gui.MIGRATE_OLD_BETA_DATA_TITLE,
830 gui.MIGRATE_OLD_BETA)
831
832 def _assert_warn_user(self, warn_fn, title, text):
833 """Assert waning a user."""
834 self.assertEqual(None, warn_fn())
835 self.assertEqual(None, self.parent)
836 self.assertEqual(self.title, title)
837 self.assertEqual(self.text, text)
838 self.assertEqual(self.ok_button, gui.QtGui.QMessageBox.Ok)
839
840 def test_warn_user_data_migration(self):
841 """Test warning the user."""
842 self._assert_warn_user(gui.warn_user_data_not_migrated,
843 gui.MIGRATE_OLD_BETA_DATA_TITLE,
844 gui.MIGRATE_OLD_BETA_DATA_ERROR)
845
846 def test_warn_user_old_app_removal(self):
847 """Test warning the user."""
848 self._assert_warn_user(gui.warn_user_beta_not_removed,
849 gui.REMOVE_OLD_BETA_TITLE,
850 gui.REMOVE_OLD_BETA_ERROR)
780851
=== modified file 'ubuntuone_installer/gui/qt/utils/__init__.py'
--- ubuntuone_installer/gui/qt/utils/__init__.py 2011-11-11 19:27:39 +0000
+++ ubuntuone_installer/gui/qt/utils/__init__.py 2011-12-01 14:58:32 +0000
@@ -42,6 +42,7 @@
42 uninstall_old_beta = windows.uninstall_old_beta42 uninstall_old_beta = windows.uninstall_old_beta
43 migrate_old_data = windows.migrate_old_data43 migrate_old_data = windows.migrate_old_data
44 check_updates = windows.check_updates44 check_updates = windows.check_updates
45 perform_old_beta_data_migration = windows.perform_old_beta_data_migration
45else:46else:
46 from ubuntuone_installer.gui.qt.utils import linux47 from ubuntuone_installer.gui.qt.utils import linux
47 uninstall_application = linux.uninstall_application48 uninstall_application = linux.uninstall_application
@@ -54,6 +55,7 @@
54 uninstall_old_beta = lambda *args, **kwargs: None55 uninstall_old_beta = lambda *args, **kwargs: None
55 migrate_old_data = lambda *args, **kwargs: None56 migrate_old_data = lambda *args, **kwargs: None
56 check_updates = lambda *args, **kwargs: None57 check_updates = lambda *args, **kwargs: None
58 perform_old_beta_data_migration = lambda *args, **kwargs: None
57# pylint: enable=C010359# pylint: enable=C0103
5860
5961
@@ -76,6 +78,10 @@
76 logger.info('Updates checked, stopping.')78 logger.info('Updates checked, stopping.')
77 stop_cb()79 stop_cb()
78 else: # No credentials80 else: # No credentials
81 # if there are no credentials it usually means that we
82 # are installing the application, before we do anything
83 # lets check if the old beta is present
84 yield perform_old_beta_data_migration(gui)
79 logger.info('Got empty credentials, starting wizard app.')85 logger.info('Got empty credentials, starting wizard app.')
80 window = gui.MainWindow(close_callback=stop_cb,86 window = gui.MainWindow(close_callback=stop_cb,
81 installing=installing)87 installing=installing)
8288
=== modified file 'ubuntuone_installer/gui/qt/utils/tests/test_common.py'
--- ubuntuone_installer/gui/qt/utils/tests/test_common.py 2011-11-11 19:28:10 +0000
+++ ubuntuone_installer/gui/qt/utils/tests/test_common.py 2011-12-01 14:58:32 +0000
@@ -69,11 +69,19 @@
6969
70 self.start_cp = lambda with_icon: \70 self.start_cp = lambda with_icon: \
71 self.called.extend(('start_cp', with_icon))71 self.called.extend(('start_cp', with_icon))
72
72 self.patch(utils, 'start_control_panel', self.start_cp)73 self.patch(utils, 'start_control_panel', self.start_cp)
7374
74 self.check_updates = lambda _: self.called.append('check_updates')75 self.check_updates = lambda _: self.called.append('check_updates')
76
75 self.patch(utils, 'check_updates', self.check_updates)77 self.patch(utils, 'check_updates', self.check_updates)
7678
79 self.migrate_data_cb = lambda gui: \
80 self.called.extend(('migrate_data_cb', gui))
81
82 self.patch(utils, 'perform_old_beta_data_migration',
83 self.migrate_data_cb)
84
77 self.patch(gui, 'MainWindow', FakeWindow)85 self.patch(gui, 'MainWindow', FakeWindow)
7886
79 @defer.inlineCallbacks87 @defer.inlineCallbacks
@@ -110,3 +118,4 @@
110 self.assertTrue(FakeWindow.visible)118 self.assertTrue(FakeWindow.visible)
111 msgs = ('Got empty credentials', 'starting wizard')119 msgs = ('Got empty credentials', 'starting wizard')
112 self.assertTrue(self.memento.check_info(*msgs))120 self.assertTrue(self.memento.check_info(*msgs))
121 self.assertEqual(self.called, ['migrate_data_cb', gui])
113122
=== modified file 'ubuntuone_installer/gui/qt/utils/tests/test_windows.py'
--- ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-11-16 15:42:44 +0000
+++ ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-12-01 14:58:32 +0000
@@ -37,6 +37,9 @@
37from ubuntuone_installer.gui.qt import utils37from ubuntuone_installer.gui.qt import utils
38from ubuntuone_installer.gui.qt.tests import BaseTestCase38from ubuntuone_installer.gui.qt.tests import BaseTestCase
3939
40# we want to test private methods
41# pylint:disable=W0212
42
4043
41class UninstallerTestCase(BaseTestCase):44class UninstallerTestCase(BaseTestCase):
4245
@@ -395,7 +398,7 @@
395 self.patch(utils.windows, 'deferToThread',398 self.patch(utils.windows, 'deferToThread',
396 fake_msi_install_product)399 fake_msi_install_product)
397 self.assertFailure(utils.uninstall_old_beta(),400 self.assertFailure(utils.uninstall_old_beta(),
398 utils.windows.MsiException)401 utils.windows.UninstallException)
399 self.assertEqual(self.called['property_uid'],402 self.assertEqual(self.called['property_uid'],
400 utils.windows.OLD_BETA_UID_KEY)403 utils.windows.OLD_BETA_UID_KEY)
401 self.assertEqual(self.called['property_name'], u'LocalPackage')404 self.assertEqual(self.called['property_name'], u'LocalPackage')
@@ -416,7 +419,7 @@
416 self.patch(utils.windows, 'get_property_for_product',419 self.patch(utils.windows, 'get_property_for_product',
417 fake_get_property_for_product)420 fake_get_property_for_product)
418 self.assertFailure(utils.uninstall_old_beta(),421 self.assertFailure(utils.uninstall_old_beta(),
419 utils.windows.MsiException)422 utils.windows.UninstallException)
420 self.assertEqual(self.called['uid'], utils.windows.OLD_BETA_UID_KEY)423 self.assertEqual(self.called['uid'], utils.windows.OLD_BETA_UID_KEY)
421 self.assertEqual(self.called['property_name'], u'LocalPackage')424 self.assertEqual(self.called['property_name'], u'LocalPackage')
422425
423426
=== modified file 'ubuntuone_installer/gui/qt/utils/windows.py'
--- ubuntuone_installer/gui/qt/utils/windows.py 2011-11-16 15:42:44 +0000
+++ ubuntuone_installer/gui/qt/utils/windows.py 2011-12-01 14:58:32 +0000
@@ -69,7 +69,8 @@
69LONG_PATH_PREFIX = u'\\\\?\\'69LONG_PATH_PREFIX = u'\\\\?\\'
70AUTO_UPDATE_EXE = 'autoupdate-windows.exe'70AUTO_UPDATE_EXE = 'autoupdate-windows.exe'
7171
72class MsiException(Exception):72
73class UninstallException(Exception):
73 """Raised when there are msi issues."""74 """Raised when there are msi issues."""
7475
7576
@@ -261,10 +262,10 @@
261 result = yield deferToThread(ctypes.windll.msi.MsiInstallProductW,262 result = yield deferToThread(ctypes.windll.msi.MsiInstallProductW,
262 uninstall_path, command_line)263 uninstall_path, command_line)
263 if result != ERROR_SUCCESS:264 if result != ERROR_SUCCESS:
264 raise MsiException('Could not remove old beta.')265 raise UninstallException('Could not remove old beta.')
265 else:266 else:
266 # the local file is missing so we cannot un install it :(267 # the local file is missing so we cannot un install it :(
267 raise MsiException('Could not remove old beta.')268 raise UninstallException('Could not remove old beta.')
268269
269270
270def _append_long_path(path):271def _append_long_path(path):
@@ -306,3 +307,26 @@
306 new_full_path = os.path.join(new_location, path)307 new_full_path = os.path.join(new_location, path)
307 yield deferToThread(shutil.move, old_full_path,308 yield deferToThread(shutil.move, old_full_path,
308 new_full_path)309 new_full_path)
310
311
312@defer.inlineCallbacks
313def perform_old_beta_data_migration(gui):
314 """Perform the migration from the old beta."""
315 if is_old_beta_installed() and \
316 gui.user_wants_to_remove_old_beta():
317 logger.debug('Old beta is installed and user wants to remove it.')
318 try:
319 # uninstall the msi and migrate data
320 yield uninstall_old_beta()
321 # ask the user if he wants to move his data
322 if gui.user_wants_to_migrate_data():
323 yield migrate_old_data()
324 except UninstallException:
325 logger.error('Could not uninstall msi: %s')
326 gui.warn_user_beta_not_removed()
327 except DataMigrationException:
328 # we did uninstall the msi \o/ but failed in the data migration.
329 # This is not a big deal, lets just tell the user that he has to
330 # manually do it
331 logger.error('Could not migrate data: %s')
332 gui.warn_user_data_not_migrated()

Subscribers

People subscribed via source and target branches