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

Python mozversion.get_version函数代码示例

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

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



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

示例1: test_with_ini_files_on_osx

    def test_with_ini_files_on_osx(self):
        self._write_ini_files()

        platform = sys.platform
        sys.platform = 'darwin'
        try:
            # get_version is working with ini files next to the binary
            self._check_version(get_version(binary=self.binary))

            # or if they are in the Resources dir
            # in this case the binary must be in a Contents dir, next
            # to the Resources dir
            contents_dir = os.path.join(self.tempdir, 'Contents')
            os.mkdir(contents_dir)
            moved_binary = os.path.join(contents_dir,
                                        os.path.basename(self.binary))
            shutil.move(self.binary, moved_binary)

            resources_dir = os.path.join(self.tempdir, 'Resources')
            os.mkdir(resources_dir)
            for ini_file in ('application.ini', 'platform.ini'):
                shutil.move(os.path.join(self.tempdir, ini_file), resources_dir)

            self._check_version(get_version(binary=moved_binary))
        finally:
            sys.platform = platform
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:26,代码来源:test_binary.py


示例2: test_with_package_name

 def test_with_package_name(self):
     with mozfile.NamedTemporaryFile() as f:
         with zipfile.ZipFile(f.name, 'w') as z:
             self.create_apk_zipfiles(z)
             z.writestr('package-name.txt', "org.mozilla.fennec")
         v = get_version(f.name)
         self.assertEqual(v.get('package_name'), "org.mozilla.fennec")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:7,代码来源:test_apk.py


示例3: __init__

    def __init__(self, device_serial=None):
        self.device_serial = device_serial

        self._logger = structured.get_default_logger(component='b2gmonkey')
        if not self._logger:
            self._logger = mozlog.getLogger('b2gmonkey')

        self.version = mozversion.get_version(
            dm_type='adb', device_serial=device_serial)

        device_id = self.version.get('device_id')
        if not device_id:
            raise B2GMonkeyError('Firefox OS device not found.')

        self.device_properties = DEVICE_PROPERTIES.get(device_id)
        if not self.device_properties:
            raise B2GMonkeyError('Unsupported device: \'%s\'' % device_id)

        android_version = self.version.get('device_firmware_version_release')
        if device_id == 'flame' and android_version == '4.4.2':
            self.device_properties.update(DEVICE_PROPERTIES.get('flame-kk'))

        self.temp_dir = tempfile.mkdtemp()
        if 'MINIDUMP_SAVE_PATH' not in os.environ:
            self.crash_dumps_path = os.path.join(self.temp_dir, 'crashes')
            os.environ['MINIDUMP_SAVE_PATH'] = self.crash_dumps_path
        else:
            self.crash_dumps_path = os.environ['MINIDUMP_SAVE_PATH']
开发者ID:JJTC-PX,项目名称:b2gmonkey,代码行数:28,代码来源:b2gmonkey.py


示例4: test_without_platform_file

    def test_without_platform_file(self):
        """With a missing platform file no exception should be thrown"""
        with open(os.path.join(self.tempdir, 'application.ini'), 'w') as f:
            f.writelines(self.application_ini)

        v = get_version(self.binary)
        self.assertTrue(isinstance(v, dict))
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:7,代码来源:test_binary.py


示例5: test_basic

 def test_basic(self):
     with mozfile.NamedTemporaryFile() as f:
         with zipfile.ZipFile(f.name, 'w') as z:
             self.create_apk_zipfiles(z)
         v = get_version(f.name)
         self.assertEqual(v.get('application_changeset'), self.application_changeset)
         self.assertEqual(v.get('platform_changeset'), self.platform_changeset)
开发者ID:luke-chang,项目名称:gecko-1,代码行数:7,代码来源:test_apk.py


示例6: __init__

    def __init__(self, marionette, datazilla_config=None, sources=None,
                 log_level='INFO'):
        # Set up logging
        handler = mozlog.StreamHandler()
        handler.setFormatter(mozlog.MozFormatter(include_timestamp=True))
        self.logger = mozlog.getLogger(self.__class__.__name__, handler)
        self.logger.setLevel(getattr(mozlog, log_level.upper()))

        self.marionette = marionette

        settings = gaiatest.GaiaData(self.marionette).all_settings
        mac_address = self.marionette.execute_script(
            'return navigator.mozWifiManager && '
            'navigator.mozWifiManager.macAddress;')

        self.submit_report = True
        self.ancillary_data = {}
        self.ancillary_data['generated_by'] = 'b2gperf %s' % __version__

        self.device = gaiatest.GaiaDevice(self.marionette)
        dm = mozdevice.DeviceManagerADB()
        self.device.add_device_manager(dm)

        version = mozversion.get_version(sources=sources, dm_type='adb')
        self.ancillary_data['build_revision'] = version.get('build_changeset')
        self.ancillary_data['gaia_revision'] = version.get('gaia_changeset')
        self.ancillary_data['gecko_revision'] = version.get('gecko_changeset')
        self.ancillary_data['ro.build.version.incremental'] = version.get(
            'device_firmware_version_incremental')
        self.ancillary_data['ro.build.version.release'] = version.get(
            'device_firmware_version_release')
        self.ancillary_data['ro.build.date.utc'] = version.get(
            'device_firmware_date')

        self.required = {
            'generated by': self.ancillary_data.get('generated_by'),
            'gaia revision': self.ancillary_data.get('gaia_revision'),
            'gecko revision': self.ancillary_data.get('gecko_revision'),
            'build revision': self.ancillary_data.get('build_revision'),
            'protocol': datazilla_config['protocol'],
            'host': datazilla_config['host'],
            'project': datazilla_config['project'],
            'branch': datazilla_config['branch'],
            'oauth key': datazilla_config['oauth_key'],
            'oauth secret': datazilla_config['oauth_secret'],
            'machine name': datazilla_config['machine_name'] or mac_address,
            'device name': datazilla_config['device_name'],
            'os version': settings.get('deviceinfo.os'),
            'id': settings.get('deviceinfo.platform_build_id')}

        for key, value in self.required.items():
            if value:
                self.logger.debug('DataZilla field: %s (%s)' % (key, value))
            if not value:
                self.submit_report = False
                self.logger.warn('Missing required DataZilla field: %s' % key)

        if not self.submit_report:
            self.logger.info('Reports will not be submitted to DataZilla')
开发者ID:jonallengriffin,项目名称:b2gperf,代码行数:59,代码来源:b2gperf.py


示例7: safe_get_version

def safe_get_version(**kwargs):
    # some really old firefox builds are not supported by mozversion
    # and let's be paranoid and handle any error (but report them!)
    try:
        return mozversion.get_version(**kwargs)
    except mozversion.VersionError, exc:
        LOG.warning("Unable to get app version: %s" % exc)
        return {}
开发者ID:EricRahm,项目名称:mozregression,代码行数:8,代码来源:launchers.py


示例8: test_binary

    def test_binary(self):
        with open(os.path.join(self.tempdir, 'application.ini'), 'w') as f:
            f.writelines(self.application_ini)

        with open(os.path.join(self.tempdir, 'platform.ini'), 'w') as f:
            f.writelines(self.platform_ini)

        self._check_version(get_version(self.binary))
开发者ID:abhishekvp,项目名称:gecko-dev,代码行数:8,代码来源:test_binary.py


示例9: test_binary_in_current_path

    def test_binary_in_current_path(self):
        with open(os.path.join(self.tempdir, 'application.ini'), 'w') as f:
            f.writelines(self.application_ini)

        with open(os.path.join(self.tempdir, 'platform.ini'), 'w') as f:
            f.writelines(self.platform_ini)
        os.chdir(self.tempdir)
        self._check_version(get_version())
开发者ID:abhishekvp,项目名称:gecko-dev,代码行数:8,代码来源:test_binary.py


示例10: _install

 def _install(self, dest):
     # get info now, as dest may be removed
     self.app_info = mozversion.get_version(binary=dest)
     self.package_name = self.app_info.get("package_name",
                                           "org.mozilla.fennec")
     self.adb = ADBAndroid()
     self.adb.uninstall_app(self.package_name)
     self.adb.install_app(dest)
开发者ID:Gioyik,项目名称:mozregression,代码行数:8,代码来源:launchers.py


示例11: test_sources_in_current_directory

    def test_sources_in_current_directory(self):
        with open(os.path.join(self.tempdir, 'application.ini'), 'w') as f:
            f.writelines(self.application_ini)

        with open(os.path.join(self.tempdir, 'sources.xml'), 'w') as f:
            f.writelines(self.sources_xml)

        os.chdir(self.tempdir)
        self._check_version(get_version())
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:9,代码来源:test_sources.py


示例12: test_with_exe

    def test_with_exe(self):
        """Test that we can resolve .exe files"""
        self._write_ini_files()

        exe_name_unprefixed = self.binary + '1'
        exe_name = exe_name_unprefixed + '.exe'
        with open(exe_name, 'w') as f:
            f.write('foobar')
        self._check_version(get_version(exe_name_unprefixed))
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:9,代码来源:test_binary.py


示例13: run_info_browser_version

def run_info_browser_version(binary):
    try:
        version_info = mozversion.get_version(binary)
    except mozversion.errors.VersionError:
        version_info = None
    if version_info:
        return {"browser_build_id": version_info.get("application_buildid", None),
                "browser_changeset": version_info.get("application_changeset", None)}
    return {}
开发者ID:alvestrand,项目名称:web-platform-tests,代码行数:9,代码来源:firefox.py


示例14: get_version_info

 def get_version_info(self, input_version_info=None):
     if input_version_info is None:
         self.saved_version_info = mozversion.get_version(binary=self.bin,
                                                          sources=self.sources,
                                                          dm_type=os.environ.get('DM_TRANS', 'adb'),
                                                          device_serial=self.device_serial)
         mozversion.get_version = self._new_get_version_info
     else:
         self.saved_version_info = input_version_info
     return self.saved_version_info
开发者ID:mwargers,项目名称:MTBF-Driver,代码行数:10,代码来源:mtbf.py


示例15: test_sources

    def test_sources(self):
        with open(os.path.join(self.tempdir, 'application.ini'), 'w') as f:
            f.writelines(self.application_ini)

        sources = os.path.join(self.tempdir, 'sources.xml')
        with open(sources, 'w') as f:
            f.writelines(self.sources_xml)

        os.chdir(self.tempdir)
        self._check_version(get_version(sources=sources))
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:10,代码来源:test_sources.py


示例16: test_basic

 def test_basic(self):
     with mozfile.NamedTemporaryFile() as f:
         with zipfile.ZipFile(f.name, 'w') as z:
             z.writestr('application.ini',
                        """[App]\nSourceStamp=%s\n""" % self.application_changeset)
             z.writestr('platform.ini',
                        """[Build]\nSourceStamp=%s\n""" % self.platform_changeset)
             z.writestr('AndroidManifest.xml', '')
         v = get_version(f.name)
         self.assertEqual(v.get('application_changeset'), self.application_changeset)
         self.assertEqual(v.get('platform_changeset'), self.platform_changeset)
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:11,代码来源:test_apk.py


示例17: _install

 def _install(self, dest):
     if self._get_device_status():
         self.adb = ADBAndroid()
         if "y" != raw_input("WARNING: bisecting nightly fennec builds will"
                             " clobber your existing nightly profile."
                             " Continue? (y or n)"):
             raise Exception("Aborting!")
     self.adb.uninstall_app("org.mozilla.fennec")
     self.adb.install_app(dest)
     # get info now, as dest may be removed
     self.app_info = mozversion.get_version(binary=dest)
开发者ID:PrathikSai,项目名称:mozregression,代码行数:11,代码来源:launchers.py


示例18: create

    def create(cls, app=None, *args, **kwargs):
        try:
            if not app:
                app_id = mozversion.get_version(binary=kwargs.get('bin'))['application_id']
                app = app_ids[app_id]

            instance_class = apps[app]
        except KeyError:
            msg = 'Application "{0}" unknown (should be one of {1})'
            raise NotImplementedError(msg.format(app, apps.keys()))

        return instance_class(*args, **kwargs)
开发者ID:ollie314,项目名称:gecko-dev,代码行数:12,代码来源:geckoinstance.py


示例19: __init__

    def __init__(self, marionette, datazilla_config=None, sources=None, log_level="INFO"):
        # Set up logging
        handler = mozlog.StreamHandler()
        handler.setFormatter(mozlog.MozFormatter(include_timestamp=True))
        self.logger = mozlog.getLogger(self.__class__.__name__, handler)
        self.logger.setLevel(getattr(mozlog, log_level.upper()))

        self.marionette = marionette

        settings = gaiatest.GaiaData(self.marionette).all_settings
        mac_address = self.marionette.execute_script(
            "return navigator.mozWifiManager && " "navigator.mozWifiManager.macAddress;"
        )

        self.submit_report = True
        self.ancillary_data = {}
        self.device = gaiatest.GaiaDevice(self.marionette)
        dm = mozdevice.DeviceManagerADB()
        self.device.add_device_manager(dm)

        version = mozversion.get_version(sources=sources, dm_type="adb")
        self.ancillary_data["build_revision"] = version.get("build_changeset")
        self.ancillary_data["gaia_revision"] = version.get("gaia_changeset")
        self.ancillary_data["gecko_revision"] = version.get("gecko_changeset")
        self.ancillary_data["ro.build.version.incremental"] = version.get("device_firmware_version_incremental")
        self.ancillary_data["ro.build.version.release"] = version.get("device_firmware_version_release")
        self.ancillary_data["ro.build.date.utc"] = version.get("device_firmware_date")

        self.required = {
            "gaia revision": self.ancillary_data.get("gaia_revision"),
            "gecko revision": self.ancillary_data.get("gecko_revision"),
            "build revision": self.ancillary_data.get("build_revision"),
            "protocol": datazilla_config["protocol"],
            "host": datazilla_config["host"],
            "project": datazilla_config["project"],
            "branch": datazilla_config["branch"],
            "oauth key": datazilla_config["oauth_key"],
            "oauth secret": datazilla_config["oauth_secret"],
            "machine name": datazilla_config["machine_name"] or mac_address,
            "device name": datazilla_config["device_name"],
            "os version": settings.get("deviceinfo.os"),
            "id": settings.get("deviceinfo.platform_build_id"),
        }

        for key, value in self.required.items():
            if value:
                self.logger.debug("DataZilla field: %s (%s)" % (key, value))
            if not value:
                self.submit_report = False
                self.logger.warn("Missing required DataZilla field: %s" % key)

        if not self.submit_report:
            self.logger.info("Reports will not be submitted to DataZilla")
开发者ID:rwood-moz,项目名称:b2gperf,代码行数:53,代码来源:b2gperf.py


示例20: collect_job_info

def collect_job_info(job, binary='', installer=''):
    """ Set job attributes (build, machine, revision, etc.)
        formatted to match Treeherder UI expectations.
        Using mozinfo and mozversion
        ref: https://github.com/mozilla/treeherder/blob/master/ui/js/values.js
        job - TestJob
        binary - path to firefox-bin
        installer - installer filename
    """
    if not binary:
        raise ValueError('Missing argument: binary.')
    build = mozversion.get_version(binary=binary)
    machine = mozinfo.info
    machine_string = build_string = ' '.join([machine['os'],
                                              machine['version'],
                                              str(machine['bits'])])
    # Narrow down build architecture; doesn't necessarily match platform
    if installer:
        job.build['package'] = installer
        if '64' in installer:
            build_string = ' '.join([machine['os'], machine['version'], '64'])
        if '32' in installer:
            build_string = ' '.join([machine['os'], machine['version'], '32'])

    # These don't match the expected Treeherder display; better than nothing.
    backup_attributes = {
        'platform': ' '.join([machine['os'].capitalize(),
                              machine['version'],
                              machine['processor']]),
        'os_name': machine['os'],
        'architecture': machine['processor']
    }
    job.build.update(backup_attributes)
    job.machine.update(backup_attributes)
    platform_attributes = get_platform_attributes(machine_string)
    if platform_attributes:
        job.machine.update(platform_attributes)
    platform_attributes = get_platform_attributes(build_string)
    if platform_attributes:
        job.build.update(platform_attributes)
    job.machine['host'] = node()
    job.build['product'] = build['application_name']
    repo_exp = re.compile(r'https://hg.mozilla.org/.*(mozilla-\w+)$')
    repo_match = repo_exp.match(build['application_repository'])
    if repo_match:
        job.build['repo'] = repo_match.group(1)
    else:
        repo_url = build['application_repository'].rsplit('/')
        job.build['repo'] = repo_url[-1]
    job.build['release'] = releases[job.build['repo']]
    job.build['revision'] = build['application_changeset']
    job.build['build_id'] = build['application_buildid']
开发者ID:mozilla,项目名称:mozplatformqa-jenkins,代码行数:52,代码来源:treeherding.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python mp3play.load函数代码示例发布时间:2022-05-27
下一篇:
Python mozuurl.MozuUrl类代码示例发布时间: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