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


Python platform.libc_ver方法代码示例

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


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

示例1: have_compatible_glibc

# 需要导入模块: import platform [as 别名]
# 或者: from platform import libc_ver [as 别名]
def have_compatible_glibc(required_major, minimum_minor):
    version_str = glibc_version_string()
    if version_str is None:
        return False
    return check_glibc_version(version_str, required_major, minimum_minor)


# platform.libc_ver regularly returns completely nonsensical glibc
# versions. E.g. on my computer, platform says:
#
#   ~$ python2.7 -c 'import platform; print(platform.libc_ver())'
#   ('glibc', '2.7')
#   ~$ python3.5 -c 'import platform; print(platform.libc_ver())'
#   ('glibc', '2.9')
#
# But the truth is:
#
#   ~$ ldd --version
#   ldd (Debian GLIBC 2.22-11) 2.22
#
# This is unfortunate, because it means that the linehaul data on libc
# versions that was generated by pip 8.1.2 and earlier is useless and
# misleading. Solution: instead of using platform, use our code that actually
# works. 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:26,代码来源:glibc.py

示例2: gather_details

# 需要导入模块: import platform [as 别名]
# 或者: from platform import libc_ver [as 别名]
def gather_details():
    """Get details about the host that is executing habu."""
    try:
        data = {
            'kernel': platform.uname(),
            'distribution': platform.linux_distribution(),
            'libc': platform.libc_ver(),
            'arch': platform.machine(),
            'python_version': platform.python_version(),
            'os_name': platform.system(),
            'static_hostname': platform.node(),
            'cpu': platform.processor(),
            'fqdn': socket.getfqdn(),
        }
    except AttributeError:
        return {}

    return data 
开发者ID:fportantier,项目名称:habu,代码行数:20,代码来源:host.py

示例3: libc_ver

# 需要导入模块: import platform [as 别名]
# 或者: from platform import libc_ver [as 别名]
def libc_ver():
    glibc_version = glibc_version_string()
    if glibc_version is None:
        # For non-glibc platforms, fall back on platform.libc_ver
        return platform.libc_ver()
    else:
        return ("glibc", glibc_version) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:9,代码来源:glibc.py

示例4: collect_platform

# 需要导入模块: import platform [as 别名]
# 或者: from platform import libc_ver [as 别名]
def collect_platform(info_add):
    import platform

    arch = platform.architecture()
    arch = ' '.join(filter(bool, arch))
    info_add('platform.architecture', arch)

    info_add('platform.python_implementation',
             platform.python_implementation())
    info_add('platform.platform',
             platform.platform(aliased=True))

    libc_ver = ('%s %s' % platform.libc_ver()).strip()
    if libc_ver:
        info_add('platform.libc_ver', libc_ver) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:pythoninfo.py

示例5: test_libc_ver

# 需要导入模块: import platform [as 别名]
# 或者: from platform import libc_ver [as 别名]
def test_libc_ver(self):
        if os.path.isdir(sys.executable) and \
           os.path.exists(sys.executable+'.exe'):
            # Cygwin horror
            executable = sys.executable + '.exe'
        else:
            executable = sys.executable
        res = platform.libc_ver(executable)

        self.addCleanup(support.unlink, support.TESTFN)
        with open(support.TESTFN, 'wb') as f:
            f.write(b'x'*(16384-10))
            f.write(b'GLIBC_1.23.4\0GLIBC_1.9\0GLIBC_1.21\0')
        self.assertEqual(platform.libc_ver(support.TESTFN),
                         ('glibc', '1.23.4')) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:test_platform.py

示例6: print_sysinfo

# 需要导入模块: import platform [as 别名]
# 或者: from platform import libc_ver [as 别名]
def print_sysinfo():
    import collections
    import datetime
    import getpass
    import platform

    info = collections.OrderedDict()
    info['OS'] = platform.system()
    if psutil.OSX:
        info['version'] = str(platform.mac_ver())
    elif psutil.WINDOWS:
        info['version'] = ' '.join(map(str, platform.win32_ver()))
        if hasattr(platform, 'win32_edition'):
            info['edition'] = platform.win32_edition()
    else:
        info['version'] = platform.version()
    if psutil.POSIX:
        info['kernel'] = '.'.join(map(str, get_kernel_version()))
    info['arch'] = ', '.join(
        list(platform.architecture()) + [platform.machine()])
    info['hostname'] = platform.node()
    info['python'] = ', '.join([
        platform.python_implementation(),
        platform.python_version(),
        platform.python_compiler()])
    if psutil.POSIX:
        s = platform.libc_ver()[1]
        if s:
            info['glibc'] = s
    info['fs-encoding'] = sys.getfilesystemencoding()
    info['time'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    info['user'] = getpass.getuser()
    info['pid'] = os.getpid()
    print("=" * 70)  # NOQA
    for k, v in info.items():
        print("%-14s %s" % (k + ':', v))  # NOQA
    print("=" * 70)  # NOQA 
开发者ID:giampaolo,项目名称:psutil,代码行数:39,代码来源:__init__.py

示例7: test_libc_ver

# 需要导入模块: import platform [as 别名]
# 或者: from platform import libc_ver [as 别名]
def test_libc_ver(self):
        import os
        if os.path.isdir(sys.executable) and \
           os.path.exists(sys.executable+'.exe'):
            # Cygwin horror
            executable = sys.executable + '.exe'
        else:
            executable = sys.executable
        res = platform.libc_ver(executable) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:11,代码来源:test_platform.py

示例8: get_system_info

# 需要导入模块: import platform [as 别名]
# 或者: from platform import libc_ver [as 别名]
def get_system_info(response):

	system_info = response["system_info"]
	home, shell = home_shell()
	language_code, encoding = locale.getdefaultlocale()

	# boot_time = lib.get_boot_time()

	# if boot_time:
	#	 if len(boot_time) == 4:
	#		 system_info.append({"BOOTUPTIME" : boot_time[3]})

	#	 if len(boot_time) == 3:
	#		 system_info.append({"BOOTUPTIME" : boot_time[2]})

	system_info.append({Klanguage().to_ts(1020) : home})
	system_info.append({Klanguage().to_ts(1021) : shell})

	#if language_code and encoding:
	#	system_info.append({"Language" : "{}/{}".format(language_code, encoding)})

	system_info.append({Klanguage().to_ts(1022) : "{0}-{1}".format(*platform.libc_ver())})

	system_info.append({Klanguage().to_ts(1024) : "{}/{}".format(platform.system(), platform.machine())})
	system_info.append({Klanguage().to_ts(1025) : "{} {}".format(*(lib.detect_distribution()))})
	system_info.append({Klanguage().to_ts(1026) : platform.release()})
	system_info.append({Klanguage().to_ts(1027) : time_op.timestamp2string(psutil.boot_time())})
	system_info.append({Klanguage().to_ts(1028) : time_op.timestamp2string(time.time())}) 
开发者ID:turingsec,项目名称:marsnake,代码行数:30,代码来源:overview.py


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