Bug 1130905 - [mozinstall] Fix re-raising of exception in case of failing install or uninstall. r=ahal, a=test-only
authorHenrik Skupin <mail@hskupin.info>
Mon, 09 Feb 2015 19:03:27 +0100
changeset 249682 fba66e1d63eeaec7db260c34c1774eaf9f164400
parent 249681 106557b12647c0b240f20b0fc7fa78763d8bcfd5
child 249683 195d0c8e3c417fd6c9a806a31a421014e864ad3c
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal, test-only
bugs1130905
milestone37.0a2
Bug 1130905 - [mozinstall] Fix re-raising of exception in case of failing install or uninstall. r=ahal, a=test-only
testing/mozbase/mozinstall/mozinstall/mozinstall.py
--- a/testing/mozbase/mozinstall/mozinstall/mozinstall.py
+++ b/testing/mozbase/mozinstall/mozinstall/mozinstall.py
@@ -121,17 +121,17 @@ def install(src, dest):
             install_dir = _install_dmg(src, dest)
         elif src.lower().endswith('.exe'):
             install_dir = _install_exe(src, dest)
 
         return install_dir
 
     except Exception, ex:
         cls, exc, trbk = sys.exc_info()
-        error = InstallError('Failed to install "%s (%s)"' % src, str(ex))
+        error = InstallError('Failed to install "%s (%s)"' % (src, str(ex)))
         raise InstallError, error, trbk
 
     finally:
         # trbk won't get GC'ed due to circular reference
         # http://docs.python.org/library/sys.html#sys.exc_info
         del trbk
 
 
@@ -195,32 +195,32 @@ def uninstall(install_folder):
         uninstall_folder = '%s\uninstall' % install_folder
         log_file = '%s\uninstall.log' % uninstall_folder
 
         if os.path.isfile(log_file):
             trbk = None
             try:
                 cmdArgs = ['%s\uninstall\helper.exe' % install_folder, '/S']
                 result = subprocess.call(cmdArgs)
-                if not result is 0:
+                if result is not 0:
                     raise Exception('Execution of uninstaller failed.')
 
                 # The uninstaller spawns another process so the subprocess call
                 # returns immediately. We have to wait until the uninstall
                 # folder has been removed or until we run into a timeout.
                 end_time = time.time() + TIMEOUT_UNINSTALL
                 while os.path.exists(uninstall_folder):
                     time.sleep(1)
 
                     if time.time() > end_time:
                         raise Exception('Failure removing uninstall folder.')
 
             except Exception, ex:
                 cls, exc, trbk = sys.exc_info()
-                error = UninstallError('Failed to uninstall %s (%s)' % install_folder, str(ex))
+                error = UninstallError('Failed to uninstall %s (%s)' % (install_folder, str(ex)))
                 raise UninstallError, error, trbk
 
             finally:
                 # trbk won't get GC'ed due to circular reference
                 # http://docs.python.org/library/sys.html#sys.exc_info
                 del trbk
 
     # Ensure that we remove any trace of the installation. Even the uninstaller
@@ -283,17 +283,17 @@ def _install_exe(src, dest):
     dest = os.path.join(dest, filename.split('.')[0])
 
     # possibly gets around UAC in vista (still need to run as administrator)
     os.environ['__compat_layer'] = 'RunAsInvoker'
     cmd = [src, '/S', '/D=%s' % os.path.realpath(dest)]
 
     # As long as we support Python 2.4 check_call will not be available.
     result = subprocess.call(cmd)
-    if not result is 0:
+    if result is not 0:
         raise Exception('Execution of installer failed.')
 
     return dest
 
 
 def install_cli(argv=sys.argv[1:]):
     parser = OptionParser(usage="usage: %prog [options] installer")
     parser.add_option('-d', '--destination',