• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mozinstall.get_binary函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mozinstall.get_binary函数的典型用法代码示例。如果您正苦于以下问题:Python get_binary函数的具体用法?Python get_binary怎么用?Python get_binary使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_binary函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: prepare_application

    def prepare_application(self, binary):
        # Prepare the binary for the test run
        if application.is_installer(self.binary, self.options.application):
            install_path = os.path.join(self.workspace, 'binary')

            print "*** Installing build: %s" % self.binary
            self._folder = mozinstall.install(self.binary, install_path)

            binary_name = APPLICATION_BINARY_NAMES[self.options.application]
            self._application = mozinstall.get_binary(self._folder,
                                                      binary_name)
        else:
            if os.path.isdir(self.binary):
                self._folder = self.binary
            else:
                if mozinfo.isMac:
                    # Ensure that self._folder is the app bundle on OS X
                    p = re.compile('.*\.app/')
                    self._folder = p.search(self.binary).group()
                else:
                    self._folder = os.path.dirname(self.binary)

            binary_name = APPLICATION_BINARY_NAMES[self.options.application]
            self._application = mozinstall.get_binary(self._folder,
                                                      binary_name)
开发者ID:andreieftimie,项目名称:mozmill-automation,代码行数:25,代码来源:testrun.py


示例2: test_get_binary

    def test_get_binary(self):
        """ Test mozinstall's get_binary method """

        if mozinfo.isLinux:
            installdir = mozinstall.install(self.bz2, self.tempdir)
            binary = os.path.join(installdir, 'firefox')
            self.assertEqual(binary, mozinstall.get_binary(installdir, 'firefox'))

        elif mozinfo.isWin:
            installdir_exe = mozinstall.install(self.exe,
                                                os.path.join(self.tempdir, 'exe'))
            binary_exe = os.path.join(installdir_exe, 'firefox', 'firefox',
                                      'firefox.exe')
            self.assertEqual(binary_exe, mozinstall.get_binary(installdir_exe,
                             'firefox'))

            installdir_zip = mozinstall.install(self.zipfile,
                                                os.path.join(self.tempdir, 'zip'))
            binary_zip = os.path.join(installdir_zip, 'firefox.exe')
            self.assertEqual(binary_zip, mozinstall.get_binary(installdir_zip,
                             'firefox'))

        elif mozinfo.isMac:
            installdir = mozinstall.install(self.dmg, self.tempdir)
            binary = os.path.join(installdir, 'Contents', 'MacOS', 'firefox')
            self.assertEqual(binary, mozinstall.get_binary(installdir, 'firefox'))
开发者ID:AutomatedTester,项目名称:mozbase,代码行数:26,代码来源:test.py


示例3: startTestRunner

def startTestRunner(runner_class, options, tests):
    install_folder = None

    try:
        # Prepare the workspace path so that all temporary data can be stored inside it.
        if options.workspace_path:
            path = os.path.expanduser(options.workspace_path)
            options.workspace = os.path.abspath(path)

            if not os.path.exists(options.workspace):
                os.makedirs(options.workspace)
        else:
            options.workspace = tempfile.mkdtemp(".{}".format(os.path.basename(sys.argv[0])))

        options.logger.info('Using workspace for temporary data: "{}"'.format(options.workspace))

        # If the specified binary is an installer it needs to be installed
        if options.installer:
            installer = os.path.realpath(options.installer)

            dest_folder = os.path.join(options.workspace, "binary")
            options.logger.info('Installing application "%s" to "%s"' % (installer, dest_folder))
            install_folder = mozinstall.install(installer, dest_folder)
            options.binary = mozinstall.get_binary(install_folder, "firefox")

        runner = runner_class(**vars(options))
        runner.run_tests(tests)

    finally:
        # Ensure to uninstall the binary if it has been installed before
        if install_folder and os.path.exists(install_folder):
            options.logger.info('Uninstalling application at "%s"' % install_folder)
            mozinstall.uninstall(install_folder)

    return runner
开发者ID:myrdd,项目名称:firefox-ui-tests,代码行数:35,代码来源:runtests.py


示例4: find_binary_path

    def find_binary_path(self,path=None, channel="nightly"):
        """Looks for the firefox binary in the virtual environment"""

        platform = {
            "Linux": "linux",
            "Windows": "win",
            "Darwin": "mac"
        }.get(uname[0])

        application_name = {
            "stable": "Firefox.app",
            "beta": "Firefox.app",
            "nightly": "Firefox Nightly.app"
        }.get(channel)

        if path is None:
            #os.getcwd() doesn't include the venv path
            path = os.path.join(os.getcwd(), "_venv", "browsers", channel)

        binary = None

        if platform == "linux":
            binary = find_executable("firefox", os.path.join(path, "firefox"))
        elif platform == "win":
            import mozinstall
            binary = mozinstall.get_binary(path, "firefox")
        elif platform == "mac":
            binary = find_executable("firefox", os.path.join(path, application_name,
                                                             "Contents", "MacOS"))

        return binary
开发者ID:frivoal,项目名称:web-platform-tests,代码行数:31,代码来源:browser.py


示例5: install

 def install(self):
     if not self.name:
         raise NotImplementedError("Can't invoke abstract base class")
     self.remove_tempdir()
     self.tempdir = tempfile.mkdtemp()
     self.binary = mozinstall.get_binary(mozinstall.install(src=self.dest, dest=self.tempdir), self.name)
     return True
开发者ID:AaronMT,项目名称:mozregression,代码行数:7,代码来源:runnightly.py


示例6: _run_tests

        def _run_tests(tags):
            application_folder = None

            try:
                # Backup current tags
                test_tags = self.test_tags

                application_folder = self.duplicate_application(source_folder)
                self.bin = mozinstall.get_binary(application_folder, 'Firefox')

                self.test_tags = tags
                super(UpdateTestRunner, self).run_tests(tests)

            except Exception:
                self.exc_info = sys.exc_info()
                self.logger.error('Failure during execution of the update test.',
                                  exc_info=self.exc_info)

            finally:
                self.test_tags = test_tags

                self.logger.info('Removing copy of the application at "%s"' % application_folder)
                try:
                    mozfile.remove(application_folder)
                except IOError as e:
                    self.logger.error('Cannot remove copy of application: "%s"' % str(e))
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:26,代码来源:update.py


示例7: _install

 def _install(self, dest):
     self.tempdir = tempfile.mkdtemp()
     try:
         self.binary = mozinstall.get_binary(
             mozinstall.install(src=dest, dest=self.tempdir),
             self.app_name
         )
     except:
         rmtree(self.tempdir)
         raise
开发者ID:JohanLorenzo,项目名称:mozregression,代码行数:10,代码来源:launchers.py


示例8: binary

def binary():
    """Return a Firefox binary"""
    try:
        return build.get_binary_path()
    except Exception:
        pass

    app = 'firefox'
    bindir = os.path.join(os.environ['PYTHON_TEST_TMP'], app)
    if os.path.isdir(bindir):
        try:
            return mozinstall.get_binary(bindir, app_name=app)
        except Exception:
            pass

    if 'GECKO_INSTALLER_URL' in os.environ:
        bindir = mozinstall.install(
            os.environ['GECKO_INSTALLER_URL'], os.environ['PYTHON_TEST_TMP'])
        return mozinstall.get_binary(bindir, app_name='firefox')
开发者ID:luke-chang,项目名称:gecko-1,代码行数:19,代码来源:fixtures.py


示例9: prepare_application

    def prepare_application(self, binary):
        # Prepare the binary for the test run
        if mozinstall.is_installer(self.binary):
            install_path = tempfile.mkdtemp(".binary")

            print "Install build: %s" % self.binary
            self._folder = mozinstall.install(self.binary, install_path)
            self._application = mozinstall.get_binary(self._folder, self.options.application)
        else:
            if os.path.isdir(self.binary):
                self._folder = self.binary
            else:
                if sys.platform == "darwin":
                    # Ensure that self._folder is the app bundle on OS X
                    p = re.compile(".*\.app/")
                    self._folder = p.search(self.binary).group()
                else:
                    self._folder = os.path.dirname(self.binary)

            self._application = mozinstall.get_binary(self._folder, self.options.application)
开发者ID:smillaedler,项目名称:mozmill-automation,代码行数:20,代码来源:testrun.py


示例10: test_get_binary

    def test_get_binary(self):
        """ Test mozinstall's get_binary method """

        if mozinfo.isLinux:
            installdir = mozinstall.install(self.bz2, self.tempdir)
            binary = os.path.join(installdir, "firefox")
            self.assertEqual(binary, mozinstall.get_binary(installdir, "firefox"))

        elif mozinfo.isWin:
            installdir_exe = mozinstall.install(self.exe, os.path.join(self.tempdir, "exe"))
            binary_exe = os.path.join(installdir_exe, "firefox", "firefox", "firefox.exe")
            self.assertEqual(binary_exe, mozinstall.get_binary(installdir_exe, "firefox"))

            installdir_zip = mozinstall.install(self.zipfile, os.path.join(self.tempdir, "zip"))
            binary_zip = os.path.join(installdir_zip, "firefox.exe")
            self.assertEqual(binary_zip, mozinstall.get_binary(installdir_zip, "firefox"))

        elif mozinfo.isMac:
            installdir = mozinstall.install(self.dmg, self.tempdir)
            binary = os.path.join(installdir, "Contents", "MacOS", "firefox")
            self.assertEqual(binary, mozinstall.get_binary(installdir, "firefox"))
开发者ID:JasonGross,项目名称:mozjs,代码行数:21,代码来源:test.py


示例11: firefox

def firefox(pytestconfig, tmpdir_factory):
    binary = os.getenv('MOZREGRESSION_BINARY',
                       pytestconfig.getoption('firefox'))
    if binary is None:
        cache_dir = str(pytestconfig.cache.makedir('firefox'))
        scraper = FactoryScraper('daily', destination=cache_dir)
        build_path = scraper.download()
        install_path = str(tmpdir_factory.mktemp('firefox'))
        install_dir = mozinstall.install(src=build_path, dest=install_path)
        binary = mozinstall.get_binary(install_dir, 'firefox')
    version = mozversion.get_version(binary)
    if hasattr(pytestconfig, '_metadata'):
        pytestconfig._metadata.update(version)
    return binary
开发者ID:99arobe,项目名称:firefox-ios,代码行数:14,代码来源:conftest.py


示例12: find_binary_path

    def find_binary_path(self,path=None, channel="nightly"):
        """Looks for the firefox binary in the virtual environment"""

        if path is None:
            #os.getcwd() doesn't include the venv path
            path = os.path.join(os.getcwd(), "_venv", "browsers", channel)

        binary = None

        if self.platform == "linux":
            binary = find_executable("firefox", os.path.join(path, "firefox"))
        elif self.platform == "win":
            import mozinstall
            binary = mozinstall.get_binary(path, "firefox")
        elif self.platform == "macos":
            binary = find_executable("firefox", os.path.join(path, self.application_name.get(channel, "Firefox Nightly.app"),
                                                             "Contents", "MacOS"))

        return binary
开发者ID:foolip,项目名称:web-platform-tests,代码行数:19,代码来源:browser.py


示例13: _run_tests

        def _run_tests(manifest):
            target_folder = None

            try:
                target_folder = self.duplicate_application(source_folder)
                self.bin = mozinstall.get_binary(target_folder, 'Firefox')

                FirefoxUITestRunner.run_tests(self, [manifest])

            except Exception:
                self.exc_info = sys.exc_info()
                self.logger.error('Failure during execution of the update test.',
                                  exc_info=self.exc_info)

            finally:
                self.logger.info('Removing copy of the application at "%s"' % target_folder)
                try:
                    mozfile.remove(target_folder)
                except IOError as e:
                    self.logger.error('Cannot remove copy of application: "%s"' % str(e))
开发者ID:Kavit900,项目名称:firefox-ui-tests,代码行数:20,代码来源:update.py


示例14: setup_env

    def setup_env(self):
        # Download the build and tests package
        self.build = self.download(url=self.build_url)
        self.packaged_tests = self.download(url=self.tests_url)

        # Unzip the packaged tests
        with zipfile.ZipFile(self.packaged_tests) as zip:
            zip.extractall('tests')

        # Create the virtual environment
        current_location = os.getcwd()
        create_venv_script = os.path.abspath(os.path.join('tests', 'tps',
                                                          'create_venv.py'))
        tps_env = os.path.abspath('tps-env')

        # Bug 1030768, setup.py has to be called from it's own location
        os.chdir(os.path.abspath(os.path.join('tests', 'tps')))

        subprocess.check_call(['python', create_venv_script,
                               '--username', self.username,
                               '--password', self.password, tps_env])
        os.chdir(current_location)

        dir = 'Scripts' if sys.platform == 'win32' else 'bin'
        env_activate_file = os.path.join(tps_env, dir, 'activate_this.py')

        # Activate the environment and set the VIRTUAL_ENV os variable
        execfile(env_activate_file, dict(__file__=env_activate_file))
        os.environ['VIRTUAL_ENV'] = tps_env

        # Install the fxa-python-client
        subprocess.check_call(['pip', 'install', 'fxa-python-client'])

        # After activating the environment we import the mozinstall module
        import mozinstall

        # Install Firefox and get the binary
        self.build_path = mozinstall.install(self.build,
                                             os.path.join(current_location,
                                                          'binary'))
        self.binary = mozinstall.get_binary(self.build_path, 'firefox')
开发者ID:mozilla,项目名称:coversheet,代码行数:41,代码来源:trigger.py


示例15: find_firefox

def find_firefox(context):
    """Try to automagically find the firefox binary."""
    import mozinstall
    search_paths = []

    # Check for a mozharness setup
    if context.mozharness_config:
        with open(context.mozharness_config, 'r') as f:
            config = json.load(f)
        workdir = os.path.join(config['base_work_dir'], config['work_dir'])
        search_paths.append(os.path.join(workdir, 'application'))

    # Check for test-stage setup
    dist_bin = os.path.join(os.path.dirname(context.package_root), 'bin')
    if os.path.isdir(dist_bin):
        search_paths.append(dist_bin)

    for path in search_paths:
        try:
            return mozinstall.get_binary(path, 'firefox')
        except mozinstall.InvalidBinary:
            continue
开发者ID:brendandahl,项目名称:positron,代码行数:22,代码来源:mach_test_package_bootstrap.py


示例16: startTestRunner

def startTestRunner(runner_class, options, tests):
    install_folder = None

    try:
        # If the specified binary is an installer it needs to be installed
        if options.installer:
            installer = os.path.realpath(options.installer)

            dest_folder = tempfile.mkdtemp()
            options.logger.info('Installing application "%s" to "%s"' % (installer,
                                                                         dest_folder))
            install_folder = mozinstall.install(installer, dest_folder)
            options.binary = mozinstall.get_binary(install_folder, 'firefox')

        runner = runner_class(**vars(options))
        runner.run_tests(tests)

    finally:
        # Ensure to uninstall the binary if it has been installed before
        if install_folder and os.path.exists(install_folder):
            options.logger.info('Uninstalling application at "%s"' % install_folder)
            mozinstall.uninstall(install_folder)

    return runner
开发者ID:IamAdiSri,项目名称:firefox-ui-tests,代码行数:24,代码来源:runtests.py


示例17: Exception

            self._repository.clone()
        except Exception, e:
            raise Exception("Failure in setting up the mozmill-tests repository. " +
                            e.message)

        if self.options.addons:
            self.prepare_addons()

        try:
            # Prepare the binary for the test run
            if mozinstall.is_installer(self.binary):
                install_path = tempfile.mkdtemp(".binary")
    
                print "Install build: %s" % self.binary
                self._folder = mozinstall.install(self.binary, install_path)
                self._application = mozinstall.get_binary(self._folder,
                                                          self.options.application)
            else:
                # TODO: Ensure that self._folder is the same as from mozinstall
                folder = os.path.dirname(self.binary)
                self._folder = folder if not os.path.isdir(self.binary) else self.binary
                self._application = self.binary

            # Prepare the repository
            ini = application.ApplicationIni(self._application)
            repository_url = ini.get('App', 'SourceRepository')
    
            # Update the mozmill-test repository to match the Gecko branch
            branch_name = self._repository.identify_branch(repository_url)
            self._repository.update(branch_name)

            # instantiate handlers
开发者ID:lblake,项目名称:mozmill-automation,代码行数:32,代码来源:testrun.py


示例18: _install

 def _install(self, dest):
     self.tempdir = tempfile.mkdtemp()
     self.binary = mozinstall.get_binary(
         mozinstall.install(src=dest, dest=self.tempdir),
         self.app_name)
开发者ID:Gioyik,项目名称:mozregression,代码行数:5,代码来源:launchers.py



注:本文中的mozinstall.get_binary函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mozinstall.install函数代码示例发布时间:2022-05-27
下一篇:
Python mozinfo.update函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap