Did I find the right examples for you? yes no

All Samples(364)  |  Call(330)  |  Derive(0)  |  Import(34)
Fairly portable uname interface. Returns a tuple
of strings (system,node,release,version,machine,processor)
identifying the underlying platform.

Note that unlike the os.uname function this also returns
possible processor information as an additional tuple entry.

Entries which cannot be determined are set to ''.

        def uname():

    """ Fairly portable uname interface. Returns a tuple
        of strings (system,node,release,version,machine,processor)
        identifying the underlying platform.

        Note that unlike the os.uname function this also returns
        possible processor information as an additional tuple entry.

        Entries which cannot be determined are set to ''.

    """
    global _uname_cache
    no_os_uname = 0

    if _uname_cache is not None:
        return _uname_cache

    processor = ''

    # Get some infos from the builtin os.uname API...
    try:
        system,node,release,version,machine = os.uname()
    except AttributeError:
        no_os_uname = 1

    if no_os_uname or not filter(None, (system, node, release, version, machine)):
        # Hmm, no there is either no uname or uname has returned
        #'unknowns'... we'll have to poke around the system then.
        if no_os_uname:
            system = sys.platform
            release = ''
            version = ''
            node = _node()
            machine = ''

        use_syscmd_ver = 1

        # Try win32_ver() on win32 platforms
        if system == 'win32':
            release,version,csd,ptype = win32_ver()
            if release and version:
                use_syscmd_ver = 0
            # Try to use the PROCESSOR_* environment variables
            # available on Win XP and later; see
            # http://support.microsoft.com/kb/888731 and
            # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM
            if not machine:
                # WOW64 processes mask the native architecture
                if "PROCESSOR_ARCHITEW6432" in os.environ:
                    machine = os.environ.get("PROCESSOR_ARCHITEW6432", '')
                else:
                    machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')
            if not processor:
                processor = os.environ.get('PROCESSOR_IDENTIFIER', machine)

        # Try the 'ver' system command available on some
        # platforms
        if use_syscmd_ver:
            system,release,version = _syscmd_ver(system)
            # Normalize system to what win32_ver() normally returns
            # (_syscmd_ver() tends to return the vendor name as well)
            if system == 'Microsoft Windows':
                system = 'Windows'
            elif system == 'Microsoft' and release == 'Windows':
                # Under Windows Vista and Windows Server 2008,
                # Microsoft changed the output of the ver command. The
                # release is no longer printed.  This causes the
                # system and release to be misidentified.
                system = 'Windows'
                if '6.0' == version[:3]:
                    release = 'Vista'
                else:
                    release = ''

        # In case we still don't know anything useful, we'll try to
        # help ourselves
        if system in ('win32','win16'):
            if not version:
                if system == 'win32':
                    version = '32bit'
                else:
                    version = '16bit'
            system = 'Windows'

        elif system[:4] == 'java':
            release,vendor,vminfo,osinfo = java_ver()
            system = 'Java'
            version = string.join(vminfo,', ')
            if not version:
                version = vendor

    # System specific extensions
    if system == 'OpenVMS':
        # OpenVMS seems to have release and version mixed up
        if not release or release == '0':
            release = version
            version = ''
        # Get processor information
        try:
            import vms_lib
        except ImportError:
            pass
        else:
            csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)
            if (cpu_number >= 128):
                processor = 'Alpha'
            else:
                processor = 'VAX'
    if not processor:
        # Get processor information from the uname system command
        processor = _syscmd_uname('-p','')

    #If any unknowns still exist, replace them with ''s, which are more portable
    if system == 'unknown':
        system = ''
    if node == 'unknown':
        node = ''
    if release == 'unknown':
        release = ''
    if version == 'unknown':
        version = ''
    if machine == 'unknown':
        machine = ''
    if processor == 'unknown':
        processor = ''

    #  normalize name
    if system == 'Microsoft' and release == 'Windows':
        system = 'Windows'
        release = 'Vista'

    _uname_cache = system,node,release,version,machine,processor
    return _uname_cache
        


src/b/e/BeginningPythonExercises-HEAD/other/system_admin/PULSA/pythonForSystemAdmin/src/example_8_1.py   BeginningPythonExercises(Download)
platform.python_version(),
platform.system(),
platform.uname(),
platform.version(),
]

src/b/e/BeginningPythonExercises-HEAD/other/system_admin/PULSA/pythonForSystemAdmin/src/example_8_2.py   BeginningPythonExercises(Download)
    def linuxType(self):
        """Uses various methods to determine Linux Type"""
        if platform.dist()[0] == self.rhel:
            return self.rhel
        elif platform.uname()[1] == self.ubu:
            return self.ubu
        elif platform.uname()[0] == self.mint:

src/c/h/cherrypy-example-HEAD/configserver/web/root.py   cherrypy-example(Download)
	def index(self, **kwargs):
		sw_version = get_version()
		return render_template("index.html", sw_version = sw_version, current_time = datetime.datetime.now(), os_info = ', '.join(platform.uname()[:4]))

src/h/o/hortonworks-sandbox-HEAD/desktop/core/ext-py/Spawning-0.9.6/src/spawning/util/system.py   hortonworks-sandbox(Download)
            'system': platform.system(),
            'temp_directory': tempfile.gettempdir(),
            'uname': platform.uname(),
    })
 

src/f/o/foobnix-HEAD/foobnix/util/LOG.py   foobnix(Download)
 
    logging.debug('==Operating System and Hardware Info==')
    logging.debug('uname:' + str(platform.uname()))
    logging.debug('system   :' + platform.system())
    logging.debug('node     :' + platform.node())

src/p/y/pyradar-0.2/pyradar/utils/system_info.py   pyradar(Download)
 
    os_and_hardware_info = {
        'uname:': platform.uname(),
        'system': platform.system(),
        'node': platform.node(),

src/s/p/Spawning-0.9.7/spawning/util/system.py   Spawning(Download)
            'system': platform.system(),
            'temp_directory': tempfile.gettempdir(),
            'uname': platform.uname(),
    })
 

src/s/p/Spawning-HEAD/spawning/util/system.py   Spawning(Download)
            'system': platform.system(),
            'temp_directory': tempfile.gettempdir(),
            'uname': platform.uname(),
    })
 

src/p/y/pyhai-0.1.3/pyhai/plugins/linux/system.py   pyhai(Download)
    def run(self, *args, **kwargs):
        return {
            'uname': platform.uname(),
            'architecture': platform.architecture()[0],
            'platform': platform.platform(),

src/p/y/PyMOTW-2.0.1/PyMOTW/platform/platform_os_info.py   PyMOTW(Download)
import platform
 
print 'uname:', platform.uname()
 
print

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next