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


Python os.uname方法代码示例

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


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

示例1: _mac_ver_xml

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def _mac_ver_xml():
    fn = '/System/Library/CoreServices/SystemVersion.plist'
    if not os.path.exists(fn):
        return None

    try:
        import plistlib
    except ImportError:
        return None

    pl = plistlib.readPlist(fn)
    release = pl['ProductVersion']
    versioninfo=('', '', '')
    machine = os.uname().machine
    if machine in ('ppc', 'Power Macintosh'):
        # for compatibility with the gestalt based code
        machine = 'PowerPC'

    return release,versioninfo,machine 
开发者ID:war-and-code,项目名称:jawfish,代码行数:21,代码来源:platform.py

示例2: _syscmd_uname

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def _syscmd_uname(option,default=''):

    """ Interface to the system's uname command.
    """
    if sys.platform in ('dos','win32','win16','os2'):
        # XXX Others too ?
        return default
    try:
        f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
    except (AttributeError,os.error):
        return default
    output = f.read().strip()
    rc = f.close()
    if not output or rc:
        return default
    else:
        return output 
开发者ID:war-and-code,项目名称:jawfish,代码行数:19,代码来源:platform.py

示例3: main

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def main():
    arguments = docopt(__doc__)

    logger.setLevel(logging.WARNING)

    if arguments['--debug']:
        logger.setLevel(logging.DEBUG)
        logging.getLogger('ciftify').setLevel(logging.DEBUG)

    ## set up the top of the log
    logger.info('{}{}'.format(ciftify.utils.ciftify_logo(),
        ciftify.utils.section_header('Starting ciftify_atlas_report')))

    ciftify.utils.log_arguments(arguments)

    with ciftify.utils.TempDir() as tmpdir:
        logger.info('Creating tempdir:{} on host:{}'.format(tmpdir,
                    os.uname()[1]))
        ret = run_ciftify_dlabel_report(arguments, tmpdir) 
开发者ID:edickie,项目名称:ciftify,代码行数:21,代码来源:ciftify_atlas_report.py

示例4: main

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def main():
    arguments       = docopt(__doc__)
    debug           = arguments['--debug']

    if debug:
        logger.setLevel(logging.DEBUG)
        logging.getLogger('ciftify').setLevel(logging.DEBUG)

    ## set up the top of the log
    logger.info('{}{}'.format(ciftify.utils.ciftify_logo(),
        ciftify.utils.section_header('Starting ciftify_vol_result')))
    ciftify.utils.log_arguments(arguments)

    settings = UserSettings(arguments)

    with ciftify.utils.TempDir() as tmpdir:
        logger.info('Creating tempdir:{} on host:{}'.format(tmpdir,
                    os.uname()[1]))
        ret = run_ciftify_vol_result(settings, tmpdir)

    logger.info(ciftify.utils.section_header('Done ciftify_vol_result'))
    sys.exit(ret) 
开发者ID:edickie,项目名称:ciftify,代码行数:24,代码来源:ciftify_vol_result.py

示例5: main

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def main():
    arguments = docopt(__doc__)

    logger.setLevel(logging.WARNING)

    if arguments['--debug']:
        logger.setLevel(logging.DEBUG)
        logging.getLogger('ciftify').setLevel(logging.DEBUG)

    ## set up the top of the log
    logger.info('{}{}'.format(ciftify.utils.ciftify_logo(),
        ciftify.utils.section_header('Starting ciftify_statclust_report')))

    ciftify.utils.log_arguments(arguments)

    with ciftify.utils.TempDir() as tmpdir:
        logger.info('Creating tempdir:{} on host:{}'.format(tmpdir,
                    os.uname()[1]))
        ret = run_ciftify_dlabel_report(arguments, tmpdir) 
开发者ID:edickie,项目名称:ciftify,代码行数:21,代码来源:ciftify_statclust_report.py

示例6: main

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def main():
    arguments = docopt(__doc__)

    logger.setLevel(logging.WARNING)

    if arguments['--debug']:
        logger.setLevel(logging.DEBUG)
        logging.getLogger('ciftify').setLevel(logging.DEBUG)

    ## set up the top of the log
    logger.info('{}{}'.format(ciftify.utils.ciftify_logo(),
        ciftify.utils.section_header('Starting ciftify_dlabel_to_vol')))

    ciftify.utils.log_arguments(arguments)

    with ciftify.utils.TempDir() as tmpdir:
        logger.info('Creating tempdir:{} on host:{}'.format(tmpdir,
                    os.uname()[1]))
        ret = run_ciftify_dlabel_to_vol(arguments, tmpdir) 
开发者ID:edickie,项目名称:ciftify,代码行数:21,代码来源:ciftify_dlabel_to_vol.py

示例7: platform

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def platform():
    ret = {
        "arch": sys.maxsize > 2**32 and "x64" or "x86",
    }

    if xbmc.getCondVisibility("system.platform.android"):
        ret["os"] = "android"
        if "arm" in os.uname()[4]:
            ret["arch"] = "arm"
    elif xbmc.getCondVisibility("system.platform.linux"):
        ret["os"] = "linux"
        if "arm" in os.uname()[4]:
            ret["arch"] = "arm"
    elif xbmc.getCondVisibility("system.platform.xbox"):
        system_platform = "xbox"
        ret["arch"] = ""
    elif xbmc.getCondVisibility("system.platform.windows"):
        ret["os"] = "windows"
    elif xbmc.getCondVisibility("system.platform.osx"):
        ret["os"] = "darwin"
    elif xbmc.getCondVisibility("system.platform.ios"):
        ret["os"] = "ios"
        ret["arch"] = "arm"

    return ret 
开发者ID:jmarth,项目名称:plugin.video.kmediatorrent,代码行数:27,代码来源:platform.py

示例8: __init__

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def __init__(self):
        if self.info is not None:
            return
        info = [ {} ]
        ok, output = getoutput('uname -m')
        if ok:
            info[0]['uname_m'] = output.strip()
        try:
            fo = open('/proc/cpuinfo')
        except EnvironmentError:
            e = get_exception()
            warnings.warn(str(e), UserWarning, stacklevel=2)
        else:
            for line in fo:
                name_value = [s.strip() for s in line.split(':', 1)]
                if len(name_value) != 2:
                    continue
                name, value = name_value
                if not info or name in info[-1]: # next processor
                    info.append({})
                info[-1][name] = value
            fo.close()
        self.__class__.info = info 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:cpuinfo.py

示例9: get_build_platform

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def get_build_platform():
    """Return this platform's string for platform-specific distributions

    XXX Currently this is the same as ``distutils.util.get_platform()``, but it
    needs some hacks for Linux and Mac OS X.
    """
    try:
        # Python 2.7 or >=3.2
        from sysconfig import get_platform
    except ImportError:
        from distutils.util import get_platform

    plat = get_platform()
    if sys.platform == "darwin" and not plat.startswith('macosx-'):
        try:
            version = _macosx_vers()
            machine = os.uname()[4].replace(" ", "_")
            return "macosx-%d.%d-%s" % (int(version[0]), int(version[1]),
                _macosx_arch(machine))
        except ValueError:
            # if someone is running a non-Mac darwin system, this will fall
            # through to the default implementation
            pass
    return plat 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:26,代码来源:__init__.py

示例10: _FakeProxyBypassHelper

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def _FakeProxyBypassHelper(fn,
                             original_module_dict=sys.modules.copy(),
                             original_uname=os.uname):
    """Setups and restores the state for the Mac OS X urllib fakes."""
    def Inner(*args, **kwargs):
      current_uname = os.uname
      current_meta_path = sys.meta_path[:]
      current_modules = sys.modules.copy()

      try:
        sys.modules.clear()
        sys.modules.update(original_module_dict)
        sys.meta_path[:] = []
        os.uname = original_uname

        return fn(*args, **kwargs)
      finally:
        sys.modules.clear()
        sys.modules.update(current_modules)
        os.uname = current_uname
        sys.meta_path[:] = current_meta_path
    return Inner 
开发者ID:elsigh,项目名称:browserscope,代码行数:24,代码来源:dev_appserver_import_hook.py

示例11: to_json

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def to_json(self):
        inventory_content = self.base_structure

        start_date = self.inventory_start.replace(
            tzinfo=datetime.timezone.utc).astimezone().replace(microsecond=0).isoformat()

        # add metadata
        inventory_content["meta"] = {
            "WARNING":
                "THIS is an alpha version of this implementation and possible changes might occur without notice",
            "start_of_data_collection": start_date,
            "duration_of_data_collection_in_seconds": (datetime.datetime.utcnow()-self.inventory_start).total_seconds(),
            "inventory_layout_version": inventory_layout_version_string,
            "data_retrieval_issues": self.data_retrieval_issues,
            "host_that_collected_inventory": os.uname()[1],
            "script_version": self.plugin_version
        }

        output = {"inventory": inventory_content}

        return json.dumps(output, default=lambda o: o.__dict__,
                          sort_keys=True, indent=4) 
开发者ID:bb-Ricardo,项目名称:check_redfish,代码行数:24,代码来源:inventory.py

示例12: _mac_ver_xml

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def _mac_ver_xml():
    fn = '/System/Library/CoreServices/SystemVersion.plist'
    if not os.path.exists(fn):
        return None

    try:
        import plistlib
    except ImportError:
        return None

    pl = plistlib.readPlist(fn)
    release = pl['ProductVersion']
    versioninfo=('', '', '')
    machine = os.uname()[4]
    if machine in ('ppc', 'Power Macintosh'):
        # for compatibility with the gestalt based code
        machine = 'PowerPC'

    return release,versioninfo,machine 
开发者ID:glmcdona,项目名称:meddle,代码行数:21,代码来源:platform.py

示例13: _syscmd_uname

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def _syscmd_uname(option,default=''):

    """ Interface to the system's uname command.
    """
    if sys.platform in ('dos','win32','win16','os2'):
        # XXX Others too ?
        return default
    try:
        f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
    except (AttributeError,os.error):
        return default
    output = string.strip(f.read())
    rc = f.close()
    if not output or rc:
        return default
    else:
        return output 
开发者ID:glmcdona,项目名称:meddle,代码行数:19,代码来源:platform.py

示例14: get_build_platform

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def get_build_platform():
    """Return this platform's string for platform-specific distributions

    XXX Currently this is the same as ``distutils.util.get_platform()``, but it
    needs some hacks for Linux and Mac OS X.
    """
    from sysconfig import get_platform

    plat = get_platform()
    if sys.platform == "darwin" and not plat.startswith('macosx-'):
        try:
            version = _macosx_vers()
            machine = os.uname()[4].replace(" ", "_")
            return "macosx-%d.%d-%s" % (
                int(version[0]), int(version[1]),
                _macosx_arch(machine),
            )
        except ValueError:
            # if someone is running a non-Mac darwin system, this will fall
            # through to the default implementation
            pass
    return plat 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:24,代码来源:__init__.py

示例15: __init__

# 需要导入模块: import os [as 别名]
# 或者: from os import uname [as 别名]
def __init__(self):
        if self.info is not None:
            return
        info = command_info(arch='arch',
                            mach='mach',
                            uname_i='uname_i',
                            isainfo_b='isainfo -b',
                            isainfo_n='isainfo -n',
                            )
        info['uname_X'] = key_value_from_command('uname -X', sep='=')
        for line in command_by_line('psrinfo -v 0'):
            m = re.match(r'\s*The (?P<p>[\w\d]+) processor operates at', line)
            if m:
                info['processor'] = m.group('p')
                break
        self.__class__.info = info 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:18,代码来源:cpuinfo.py


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