當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。