Ejemplo n.º 1
0
    def _get_test_candidate(version: str, locale: str) -> str or None:
        """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
        """
        logger.debug('Getting build, version %s, locale %s' %
                     (version, locale))
        if version == 'local':
            candidate = PathManager.get_local_firefox_path()
            if candidate is None:
                logger.critical(
                    'Firefox not found. Please download if from https://www.mozilla.org/en-US/firefox/new/'
                )
            return candidate
        elif os.path.isfile(version):
            return version
        else:
            try:
                s_t, s_d = _get_scraper_details(
                    version, CHANNELS,
                    os.path.join(PathManager.get_working_dir(), 'cache'),
                    locale)

                scraper = FactoryScraper(s_t, **s_d)
                firefox_dmg = scraper.download()

                install_dir = install(src=firefox_dmg,
                                      dest=os.path.join(
                                          PathManager.get_temp_dir(),
                                          'firefox{}{}'.format(
                                              normalize_str(version),
                                              normalize_str(locale))))

                return get_binary(install_dir, 'Firefox')
            except errors.NotFoundError:
                logger.critical(
                    'Specified build {} has not been found. Closing Iris ...'.
                    format(version))
        return None
Ejemplo n.º 2
0
    def at_exit():
        reset_terminal_encoding()

        if os.path.exists(PathManager.get_temp_dir()):
            shutil.rmtree(PathManager.get_temp_dir(), ignore_errors=True)