Ejemplo n.º 1
0
    def _overwrite_app(self):  # pragma: no cover
        # Unix: Overwrites the running applications binary
        if jms_utils.system.get_system() == 'mac':
            if self.current_app_dir.endswith('MacOS') is True:
                log.debug('Looks like we\'re dealing with a Mac Gui')
                temp_dir = get_mac_dot_app_dir(self.current_app_dir)
                self.current_app_dir = temp_dir

        app_update = os.path.join(self.update_folder, self.name)
        # Must be dealing with Mac .app application
        if not os.path.exists(app_update):
            app_update += '.app'
        log.debug('Update Location'
                  ':\n{}'.format(os.path.dirname(app_update)))
        log.debug('Update Name: {}'.format(os.path.basename(app_update)))

        current_app = os.path.join(self.current_app_dir, self.name)
        # Must be dealing with Mac .app application
        if not os.path.exists(current_app):
            current_app += '.app'
        log.debug('Current App location:\n\n{}'.format(current_app))
        # Remove current app to prevent errors when moving
        # update to new location
        if os.path.exists(current_app):
            if os.path.isfile(current_app):
                os.remove(current_app)
            else:
                shutil.rmtree(current_app, ignore_errors=True)

        log.debug('Moving app to new location')
        shutil.move(app_update, os.path.dirname(current_app))
Ejemplo n.º 2
0
    def _overwrite_app(self):  # pragma: no cover
        # Unix: Overwrites the running applications binary
        if jms_utils.system.get_system() == 'mac':
            if self.current_app_dir.endswith('MacOS') is True:
                log.debug('Looks like we\'re dealing with a Mac Gui')
                temp_dir = get_mac_dot_app_dir(self.current_app_dir)
                self.current_app_dir = temp_dir

        app_update = os.path.join(self.update_folder, self.name)
        # Must be dealing with Mac .app application
        if not os.path.exists(app_update):
            app_update += '.app'
        log.debug('Update Location'
                  ':\n{}'.format(os.path.dirname(app_update)))
        log.debug('Update Name: {}'.format(os.path.basename(app_update)))

        current_app = os.path.join(self.current_app_dir, self.name)
        # Must be dealing with Mac .app application
        if not os.path.exists(current_app):
            current_app += '.app'
        log.debug('Current App location:\n\n{}'.format(current_app))
        # Remove current app to prevent errors when moving
        # update to new location
        if os.path.exists(current_app):
            if os.path.isfile(current_app):
                os.remove(current_app)
            else:
                shutil.rmtree(current_app, ignore_errors=True)

        log.debug('Moving app to new location')
        shutil.move(app_update, os.path.dirname(current_app))
Ejemplo n.º 3
0
 def test_get_mac_app_dir(self):
     main = 'Main'
     path = os.path.join(main, 'Contents', 'MacOS', 'app')
     assert get_mac_dot_app_dir(path) == main
Ejemplo n.º 4
0
 def test_get_mac_app_dir(self):
     main = 'Main'
     path = os.path.join(main, 'Contents', 'MacOS', 'app')
     assert get_mac_dot_app_dir(path) == main