当前位置: 首页>>代码示例>>Python>>正文


Python sys.pypy_version_info方法代码示例

本文整理汇总了Python中sys.pypy_version_info方法的典型用法代码示例。如果您正苦于以下问题:Python sys.pypy_version_info方法的具体用法?Python sys.pypy_version_info怎么用?Python sys.pypy_version_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sys的用法示例。


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

示例1: pytest_sessionstart

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def pytest_sessionstart(self, session):
        self._session = session
        self._sessionstarttime = time.time()
        if not self.showheader:
            return
        self.write_sep("=", "test session starts", bold=True)
        verinfo = platform.python_version()
        msg = "platform {} -- Python {}".format(sys.platform, verinfo)
        if hasattr(sys, "pypy_version_info"):
            verinfo = ".".join(map(str, sys.pypy_version_info[:3]))
            msg += "[pypy-{}-{}]".format(verinfo, sys.pypy_version_info[3])
        msg += ", pytest-{}, py-{}, pluggy-{}".format(
            pytest.__version__, py.__version__, pluggy.__version__
        )
        if (
            self.verbosity > 0
            or self.config.option.debug
            or getattr(self.config.option, "pastebin", None)
        ):
            msg += " -- " + str(sys.executable)
        self.write_line(msg)
        lines = self.config.hook.pytest_report_header(
            config=self.config, startdir=self.startdir
        )
        self._write_report_lines_from_hooks(lines) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:27,代码来源:terminal.py

示例2: print_banner

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def print_banner(label):
    """Print the version of Python."""
    try:
        impl = platform.python_implementation()
    except AttributeError:
        impl = "Python"

    version = platform.python_version()

    if '__pypy__' in sys.builtin_module_names:
        version += " (pypy %s)" % ".".join(str(v) for v in sys.pypy_version_info)

    try:
        which_python = os.path.relpath(sys.executable)
    except ValueError:
        # On Windows having a python executable on a different drive
        # than the sources cannot be relative.
        which_python = sys.executable
    print('=== %s %s %s (%s) ===' % (impl, version, label, which_python))
    sys.stdout.flush() 
开发者ID:nedbat,项目名称:coveragepy-bbmirror,代码行数:22,代码来源:igor.py

示例3: test_is_precisely_correct_version

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def test_is_precisely_correct_version(self):

        toxenvname = 'TOX_%s' % os.environ['TOX_ENV_NAME'].upper().strip()
        expected_string = os.environ[toxenvname].strip(' "\'')
        print('\n\nTOX ENV NAME: %s' % toxenvname)
        if platform.python_implementation() == 'PyPy':
            actual_list = [str(_).strip() for _ in sys.pypy_version_info[:3]]
            expected_string = expected_string.split('-')[1].strip(' "\'')
            print('\nExpected version for this tox env: PyPy %s'
                  % expected_string)
            print('Actual version for this tox env: PyPy %s'
                  % '.'.join(actual_list))
        else:
            print('\nExpected version for this tox env: Python %s'
                  % expected_string)
            print('Actual version for this tox env: Python %s'
                  % platform.python_version())
            actual_list = list(platform.python_version_tuple())
        expected_list = expected_string.split('.')

        print('\n\nPYTHON VERSION (verbose)')
        print('*************************')
        print(sys.version)
        print('\n')
        self.assertEqual(actual_list, expected_list) 
开发者ID:stavxyz,项目名称:tox-pyenv,代码行数:27,代码来源:test_tox_pyenv.py

示例4: user_agent

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def user_agent(name, version):
    """Return User-Agent ~ "name/version language/version interpreter/version os/version"."""

    def _interpreter():
        name = platform.python_implementation()
        version = platform.python_version()
        bitness = platform.architecture()[0]
        if name == 'PyPy':
            version = '.'.join(map(str, sys.pypy_version_info[:3]))
        full_version = [version]
        if bitness:
            full_version.append(bitness)
        return name, "-".join(full_version)

    tags = [
        (name, version),
        ("python", platform.python_version()),
        _interpreter(),
        ("machine", platform.machine() or 'unknown'),
        ("system", platform.system() or 'unknown'),
        ("platform", platform.platform() or 'unknown'),
    ]

    return ' '.join("{}/{}".format(name, version) for name, version in tags) 
开发者ID:dwavesystems,项目名称:dwave-cloud-client,代码行数:26,代码来源:utils.py

示例5: pytest_benchmark_generate_machine_info

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def pytest_benchmark_generate_machine_info():
    python_implementation = platform.python_implementation()
    python_implementation_version = platform.python_version()
    if python_implementation == 'PyPy':
        python_implementation_version = '%d.%d.%d' % sys.pypy_version_info[:3]
        if sys.pypy_version_info.releaselevel != 'final':
            python_implementation_version += '-%s%d' % sys.pypy_version_info[3:]
    return {
        "node": platform.node(),
        "processor": platform.processor(),
        "machine": platform.machine(),
        "python_compiler": platform.python_compiler(),
        "python_implementation": python_implementation,
        "python_implementation_version": python_implementation_version,
        "python_version": platform.python_version(),
        "python_build": platform.python_build(),
        "release": platform.release(),
        "system": platform.system(),
        "cpu": get_cpu_info(),
    } 
开发者ID:ionelmc,项目名称:pytest-benchmark,代码行数:22,代码来源:plugin.py

示例6: python_version_string

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def python_version_string():
    """We use it to generate per python folder name, where
    we will install all packages.
    """
    if platform.python_implementation() == 'PyPy':
        version_info = sys.pypy_version_info
    else:
        version_info = sys.version_info
    version_string = '{v.major}.{v.minor}.{v.micro}'.format(v=version_info)
    build, _ = platform.python_build()
    build = build.replace(':', '_')  # windows do not understand `:` in path
    return '{}-{}-{}'.format(platform.python_implementation(), version_string, build) 
开发者ID:Deepwalker,项目名称:pundler,代码行数:14,代码来源:pundle.py

示例7: make_env_id

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def make_env_id(tracer):
    """An environment id that will keep all the test runs distinct."""
    impl = platform.python_implementation().lower()
    version = "%s%s" % sys.version_info[:2]
    if '__pypy__' in sys.builtin_module_names:
        version += "_%s%s" % sys.pypy_version_info[:2]
    env_id = "%s%s_%s" % (impl, version, tracer)
    return env_id 
开发者ID:nedbat,项目名称:coveragepy,代码行数:10,代码来源:igor.py

示例8: get_service_info

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def get_service_info(self):
        if self._service_info:
            return self._service_info
        language_version = platform.python_version()
        if hasattr(sys, "pypy_version_info"):
            runtime_version = ".".join(map(str, sys.pypy_version_info[:3]))
        else:
            runtime_version = language_version
        result = {
            "name": keyword_field(self.config.service_name),
            "environment": keyword_field(self.config.environment),
            "version": keyword_field(self.config.service_version),
            "agent": {"name": "python", "version": elasticapm.VERSION},
            "language": {"name": "python", "version": keyword_field(platform.python_version())},
            "runtime": {
                "name": keyword_field(platform.python_implementation()),
                "version": keyword_field(runtime_version),
            },
        }
        if self.config.framework_name:
            result["framework"] = {
                "name": keyword_field(self.config.framework_name),
                "version": keyword_field(self.config.framework_version),
            }
        if self.config.service_node_name:
            result["node"] = {"configured_name": keyword_field(self.config.service_node_name)}
        self._service_info = result
        return result 
开发者ID:elastic,项目名称:apm-agent-python,代码行数:30,代码来源:base.py

示例9: as_dict

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def as_dict():
    """
    Return debug information as a dictionary.
    """

    debug_info = dict()

    debug_info['os_name'] = platform.system()
    debug_info['os_version'] = platform.release()

    debug_info['cpu_arch'] = platform.machine()
    debug_info['bit_size'] = ctypes.sizeof(ctypes.c_void_p) * 8

    char_len = len(b'\\U00010142'.decode('unicode-escape'))
    if char_len == 1:
        debug_info['unicode_size'] = 'wide'
    elif char_len == 2:
        debug_info['unicode_size'] = 'narrow'
    else:
        # Should not happen
        debug_info['unicode_size'] = 'unknown'

    impl = platform.python_implementation()
    debug_info['impl'] = impl

    if impl == 'CPython':
        impl_version = version_string(sys.version_info)
    elif impl == 'PyPy':
        impl_version = version_string(sys.pypy_version_info)
    elif impl == 'Jython':
        impl_version = version_string(sys.version_info)  # TODO: Verify
    elif impl == 'IronPython':
        impl_version = version_string(sys.version_info)  # TODO: Verify
    else:
        impl_version = 'unknown'
    debug_info['impl_version'] = impl_version

    debug_info['python_version'] = platform.python_version()

    debug_info['zhmcclient_version'] = zhmcclient_version

    return debug_info 
开发者ID:zhmcclient,项目名称:python-zhmcclient,代码行数:44,代码来源:debuginfo.py

示例10: user_agent_extended

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def user_agent_extended(be_geo_id, caller):
    # Generate extended portion of the User-Agent
    user_agent_extended = be_geo_id
    user_agent_extended = {}

    # Mimic pip system data collection per https://github.com/pypa/pip/blob/master/src/pip/_internal/network/session.py
    user_agent_extended['implementation'] = {
            "name": platform.python_implementation(),
        }

    if user_agent_extended["implementation"]["name"] in ('CPython','Jython','IronPython'):
        user_agent_extended["implementation"]["version"] = platform.python_version()
    elif user_agent_extended["implementation"]["name"] == 'PyPy':
        if sys.pypy_version_info.releaselevel == 'final':
            pypy_version_info = sys.pypy_version_info[:3]
        else:
            pypy_version_info = sys.pypy_version_info
        user_agent_extended["implementation"]["version"] = ".".join(
            [str(x) for x in pypy_version_info]
        )

    if sys.platform.startswith("darwin") and platform.mac_ver()[0]:
        user_agent_extended["distro"] = {"name": "macOS", "version": platform.mac_ver()[0]}

    if platform.system():
        user_agent_extended.setdefault("system", {})["name"] = platform.system()

    if platform.release():
        user_agent_extended.setdefault("system", {})["release"] = platform.release()

    if platform.machine():
        user_agent_extended["cpu"] = platform.machine()

    if be_geo_id:
        user_agent_extended["be_geo_id"] = be_geo_id

    if caller:
        user_agent_extended["caller"] = caller

    return urllib.parse.quote(json.dumps(user_agent_extended))


# Main module interface 
开发者ID:meraki,项目名称:dashboard-api-python,代码行数:45,代码来源:rest_session.py

示例11: run_tests_with_coverage

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def run_tests_with_coverage(tracer, *runner_args):
    """Run tests, but with coverage."""
    # Need to define this early enough that the first import of env.py sees it.
    os.environ['COVERAGE_TESTING'] = "True"
    os.environ['COVERAGE_PROCESS_START'] = os.path.abspath('metacov.ini')
    os.environ['COVERAGE_HOME'] = os.getcwd()

    # Create the .pth file that will let us measure coverage in sub-processes.
    # The .pth file seems to have to be alphabetically after easy-install.pth
    # or the sys.path entries aren't created right?
    pth_dir = os.path.dirname(pytest.__file__)
    pth_path = os.path.join(pth_dir, "zzz_metacov.pth")
    with open(pth_path, "w") as pth_file:
        pth_file.write("import coverage; coverage.process_startup()\n")

    # Make names for the data files that keep all the test runs distinct.
    impl = platform.python_implementation().lower()
    version = "%s%s" % sys.version_info[:2]
    if '__pypy__' in sys.builtin_module_names:
        version += "_%s%s" % sys.pypy_version_info[:2]
    suffix = "%s%s_%s_%s" % (impl, version, tracer, platform.platform())

    os.environ['COVERAGE_METAFILE'] = os.path.abspath(".metacov."+suffix)

    import coverage
    cov = coverage.Coverage(config_file="metacov.ini", data_suffix=False)
    cov._warn_unimported_source = False
    cov._warn_preimported_source = False
    cov.start()

    try:
        # Re-import coverage to get it coverage tested!  I don't understand all
        # the mechanics here, but if I don't carry over the imported modules
        # (in covmods), then things go haywire (os == None, eventually).
        covmods = {}
        covdir = os.path.split(coverage.__file__)[0]
        # We have to make a list since we'll be deleting in the loop.
        modules = list(sys.modules.items())
        for name, mod in modules:
            if name.startswith('coverage'):
                if getattr(mod, '__file__', "??").startswith(covdir):
                    covmods[name] = mod
                    del sys.modules[name]
        import coverage                         # pylint: disable=reimported
        sys.modules.update(covmods)

        # Run tests, with the arguments from our command line.
        status = run_tests(tracer, *runner_args)

    finally:
        cov.stop()
        os.remove(pth_path)

    cov.combine()
    cov.save()

    return status 
开发者ID:nedbat,项目名称:coveragepy-bbmirror,代码行数:59,代码来源:igor.py

示例12: user_agent

# 需要导入模块: import sys [as 别名]
# 或者: from sys import pypy_version_info [as 别名]
def user_agent():
    """
    Return a string representing the user agent.
    """
    data = {
        "installer": {"name": "pip", "version": pip.__version__},
        "python": platform.python_version(),
        "implementation": {
            "name": platform.python_implementation(),
        },
    }

    if data["implementation"]["name"] == 'CPython':
        data["implementation"]["version"] = platform.python_version()
    elif data["implementation"]["name"] == 'PyPy':
        if sys.pypy_version_info.releaselevel == 'final':
            pypy_version_info = sys.pypy_version_info[:3]
        else:
            pypy_version_info = sys.pypy_version_info
        data["implementation"]["version"] = ".".join(
            [str(x) for x in pypy_version_info]
        )
    elif data["implementation"]["name"] == 'Jython':
        # Complete Guess
        data["implementation"]["version"] = platform.python_version()
    elif data["implementation"]["name"] == 'IronPython':
        # Complete Guess
        data["implementation"]["version"] = platform.python_version()

    if sys.platform.startswith("linux"):
        distro = dict(filter(
            lambda x: x[1],
            zip(["name", "version", "id"], platform.linux_distribution()),
        ))
        libc = dict(filter(
            lambda x: x[1],
            zip(["lib", "version"], platform.libc_ver()),
        ))
        if libc:
            distro["libc"] = libc
        if distro:
            data["distro"] = distro

    if sys.platform.startswith("darwin") and platform.mac_ver()[0]:
        data["distro"] = {"name": "OS X", "version": platform.mac_ver()[0]}

    if platform.system():
        data.setdefault("system", {})["name"] = platform.system()

    if platform.release():
        data.setdefault("system", {})["release"] = platform.release()

    if platform.machine():
        data["cpu"] = platform.machine()

    return "{data[installer][name]}/{data[installer][version]} {json}".format(
        data=data,
        json=json.dumps(data, separators=(",", ":"), sort_keys=True),
    ) 
开发者ID:chalasr,项目名称:Flask-P2P,代码行数:61,代码来源:download.py


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