예제 #1
0
파일: __main__.py 프로젝트: wizofe/iris
 def at_exit():
     if hasattr(Iris, 'process_list'):
         logger.debug('There are %s queued process(es) to terminate.' % len(Iris.process_list))
         for process in Iris.process_list:
             logger.debug('Terminating process.')
             process.terminate()
             process.join()
     if Settings.is_mac():
         # Extra call to shutdown the program we use to check keyboard lock,
         # in case Iris was terminated abruptly.
         IrisCore.shutdown_process('Xquartz')
예제 #2
0
    def get_test_candidate(self):
        """Download and extract a build candidate.

        Build may either refer to a Firefox release identifier, package, or build directory.
        :param:
            build: str with firefox build
        :return:
            Installation path for the Firefox App
        """

        location = ''
        candidate_app = ''

        if self.args.firefox == 'local':
            if Settings.is_mac():
                location = '/Applications/Firefox.app/Contents/'
                candidate_app = os.path.join(location, 'MacOS', 'firefox')
            elif Settings.is_windows():
                location = 'C:\\Program Files (x86)\\Mozilla Firefox'
                if not os.path.exists(location):
                    location = 'C:\\Program Files\\Mozilla Firefox'
                    candidate_app = os.path.join(location, 'firefox.exe')
            elif Settings.is_linux():
                location = '/usr/lib/firefox'
                candidate_app = os.path.join(location, 'firefox')
            else:
                logger.critical('Platform not supported')
                self.finish(code=5)

            if not os.path.isdir(location):
                logger.critical(
                    'Firefox not found. Please download if from https://www.mozilla.org/en-US/firefox/new/'
                )
                self.finish(code=5)

            return candidate_app

        else:
            try:
                locale = 'ja-JP-mac' if self.args.locale == 'ja' and Settings.is_mac(
                ) else self.args.locale
                type, scraper_details = get_scraper_details(
                    self.args.firefox, Settings.CHANNELS,
                    os.path.join(IrisCore.get_working_dir(), 'cache'), locale)
                scraper = FactoryScraper(type, **scraper_details)

                firefox_dmg = scraper.download()
                install_folder = install(src=firefox_dmg,
                                         dest=IrisCore.get_current_run_dir())

                binary = get_binary(install_folder, 'Firefox')

                channel = get_firefox_channel(binary)
                latest_type, latest_scraper_details = get_latest_scraper_details(
                    channel)
                latest_path = FactoryScraper(latest_type,
                                             **latest_scraper_details).filename

                self.latest_version = get_version_from_path(latest_path)
                logger.info('Latest available version for %s channel is: %s' %
                            (channel, self.latest_version))

                return binary
            except errors.NotFoundError:
                logger.critical(
                    'Specified build (%s) has not been found. Closing Iris ...'
                    % self.args.firefox)
                self.finish(5)