Did I find the right examples for you? yes no

All Samples(107)  |  Call(107)  |  Derive(0)  |  Import(0)
Get additional version information from the Windows Registry
and return a tuple (version,csd,ptype) referring to version
number, CSD level (service pack), and OS type (multi/single
processor).

As a hint: ptype returns 'Uniprocessor Free' on single
processor NT machines and 'Multiprocessor Free' on multi
processor machines. The 'Free' refers to the OS version being
free of debugging code. It could also state 'Checked' which
means the OS version uses debugging code, i.e. code that(more...)

        def win32_ver(release='',version='',csd='',ptype=''):

    """ Get additional version information from the Windows Registry
        and return a tuple (version,csd,ptype) referring to version
        number, CSD level (service pack), and OS type (multi/single
        processor).

        As a hint: ptype returns 'Uniprocessor Free' on single
        processor NT machines and 'Multiprocessor Free' on multi
        processor machines. The 'Free' refers to the OS version being
        free of debugging code. It could also state 'Checked' which
        means the OS version uses debugging code, i.e. code that
        checks arguments, ranges, etc. (Thomas Heller).

        Note: this function works best with Mark Hammond's win32
        package installed, but also on Python 2.3 and later. It
        obviously only runs on Win32 compatible platforms.

    """
    # XXX Is there any way to find out the processor type on WinXX ?
    # XXX Is win32 available on Windows CE ?
    #
    # Adapted from code posted by Karl Putland to comp.lang.python.
    #
    # The mappings between reg. values and release names can be found
    # here: http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp

    # Import the needed APIs
    try:
        import win32api
        from win32api import RegQueryValueEx, RegOpenKeyEx, \
             RegCloseKey, GetVersionEx
        from win32con import HKEY_LOCAL_MACHINE, VER_PLATFORM_WIN32_NT, \
             VER_PLATFORM_WIN32_WINDOWS, VER_NT_WORKSTATION
    except ImportError:
        # Emulate the win32api module using Python APIs
        try:
            sys.getwindowsversion
        except AttributeError:
            # No emulation possible, so return the defaults...
            return release,version,csd,ptype
        else:
            # Emulation using _winreg (added in Python 2.0) and
            # sys.getwindowsversion() (added in Python 2.3)
            import _winreg
            GetVersionEx = sys.getwindowsversion
            RegQueryValueEx = _winreg.QueryValueEx
            RegOpenKeyEx = _winreg.OpenKeyEx
            RegCloseKey = _winreg.CloseKey
            HKEY_LOCAL_MACHINE = _winreg.HKEY_LOCAL_MACHINE
            VER_PLATFORM_WIN32_WINDOWS = 1
            VER_PLATFORM_WIN32_NT = 2
            VER_NT_WORKSTATION = 1
            VER_NT_SERVER = 3
            REG_SZ = 1

    # Find out the registry key and some general version infos
    winver = GetVersionEx()
    maj,min,buildno,plat,csd = winver
    version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF)
    if hasattr(winver, "service_pack"):
        if winver.service_pack != "":
            csd = 'SP%s' % winver.service_pack_major
    else:
        if csd[:13] == 'Service Pack ':
            csd = 'SP' + csd[13:]

    if plat == VER_PLATFORM_WIN32_WINDOWS:
        regkey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
        # Try to guess the release name
        if maj == 4:
            if min == 0:
                release = '95'
            elif min == 10:
                release = '98'
            elif min == 90:
                release = 'Me'
            else:
                release = 'postMe'
        elif maj == 5:
            release = '2000'

    elif plat == VER_PLATFORM_WIN32_NT:
        regkey = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'
        if maj <= 4:
            release = 'NT'
        elif maj == 5:
            if min == 0:
                release = '2000'
            elif min == 1:
                release = 'XP'
            elif min == 2:
                release = '2003Server'
            else:
                release = 'post2003'
        elif maj == 6:
            if hasattr(winver, "product_type"):
                product_type = winver.product_type
            else:
                product_type = VER_NT_WORKSTATION
                # Without an OSVERSIONINFOEX capable sys.getwindowsversion(),
                # or help from the registry, we cannot properly identify
                # non-workstation versions.
                try:
                    key = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey)
                    name, type = RegQueryValueEx(key, "ProductName")
                    # Discard any type that isn't REG_SZ
                    if type == REG_SZ and name.find("Server") != -1:
                        product_type = VER_NT_SERVER
                except WindowsError:
                    # Use default of VER_NT_WORKSTATION
                    pass

            if min == 0:
                if product_type == VER_NT_WORKSTATION:
                    release = 'Vista'
                else:
                    release = '2008Server'
            elif min == 1:
                if product_type == VER_NT_WORKSTATION:
                    release = '7'
                else:
                    release = '2008ServerR2'
            elif min == 2:
                if product_type == VER_NT_WORKSTATION:
                    release = '8'
                else:
                    release = '2012Server'
            else:
                release = 'post2012Server'

    else:
        if not release:
            # E.g. Win3.1 with win32s
            release = '%i.%i' % (maj,min)
        return release,version,csd,ptype

    # Open the registry key
    try:
        keyCurVer = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey)
        # Get a value to make sure the key exists...
        RegQueryValueEx(keyCurVer, 'SystemRoot')
    except:
        return release,version,csd,ptype

    # Parse values
    #subversion = _win32_getvalue(keyCurVer,
    #                            'SubVersionNumber',
    #                            ('',1))[0]
    #if subversion:
    #   release = release + subversion # 95a, 95b, etc.
    build = _win32_getvalue(keyCurVer,
                            'CurrentBuildNumber',
                            ('',1))[0]
    ptype = _win32_getvalue(keyCurVer,
                           'CurrentType',
                           (ptype,1))[0]

    # Normalize version
    version = _norm_version(version,build)

    # Close key
    RegCloseKey(keyCurVer)
    return release,version,csd,ptype
        


src/r/e/RedJack-0.3.0/redjack/agent.py   RedJack(Download)
                    caps[key] = os.environ[key]
        elif caps['system'] == "Windows":
            caps['win32_ver'] = "-".join(platform.win32_ver())
            for key in ["USERNAME", "USERDOMAIN", "HOMEPATH", "PATH", "COMPUTERNAME", "OS"]:
                caps[key] = os.environ[key]

src/p/a/pave-0.69/pave/inspector.py   pave(Download)
        proc=p.processor(),py_vers=p.python_version(),
        py_vert=p.python_version_tuple(),os_release=p.release(),
        system=p.system(),version=p.version(),win_vers=p.win32_ver(),
        mac_vers=p.mac_ver(),linux_dist=p.linux_distribution(),
    )

src/g/s/gsdview-HEAD/gsdview/utils.py   gsdview(Download)
    elif platform.mac_ver() != ('', ('', '', ''), ''):
        platform_info.append('Mac OS X: %s\n' % platform.mac_ver()[0])
    elif platform.win32_ver() != ('', '', '', ''):
        platform_info.append('Windows: %s\n' % platform.win32_ver()[0])
 

src/g/r/GraphLab-Create-0.2.0/graphlab_util/metric_tracker.py   GraphLab-Create(Download)
      self._sys_info['os_version'] = self._tup_to_flat_str(platform.mac_ver())
    elif self._sys_info['system'] == 'Windows':
      self._sys_info['os_version'] = self._tup_to_flat_str(platform.win32_ver())
    elif self._sys_info['system'] == 'Java':
      self._sys_info['os_version'] = self._tup_to_flat_str(platform.java_ver())

src/c/a/calibre-HEAD/src/calibre/debug.py   calibre(Download)
    try:
        if iswindows:
            out('Windows:', platform.win32_ver())
        elif isosx:
            out('OSX:', platform.mac_ver())

src/d/r/DrQueueIPython-0.0.1/DrQueue/computer.py   DrQueueIPython(Download)
            osver = platform.mac_ver()[0]
        if osname in ["Windows", "Win32"]:
            osver = platform.win32_ver()[0] + " " + platform.win32_ver()[1]
        if osname == "Linux":
            osver = platform.linux_distribution()[0] + " " + platform.linux_distribution()[1]

src/d/r/DrQueueIPython-HEAD/DrQueue/computer.py   DrQueueIPython(Download)
            osver = platform.mac_ver()[0]
        if osname in ["Windows", "Win32"]:
            osver = platform.win32_ver()[0] + " " + platform.win32_ver()[1]
        if osname == "Linux":
            osver = platform.linux_distribution()[0] + " " + platform.linux_distribution()[1]

src/d/i/diamond-3.4.339/src/collectors/stats/stats.py   diamond(Download)
 
        elif platform.system() == 'Windows':
            ver = platform.win32_ver()
            os_version = ('Windows', ver[0], ver[2])
 

src/d/i/Diamond-HEAD/src/collectors/stats/stats.py   Diamond(Download)
 
        elif platform.system() == 'Windows':
            ver = platform.win32_ver()
            os_version = ('Windows', ver[0], ver[2])
 

src/g/l/Glances-1.7.6/glances/glances.py   Glances(Download)
            self.host['os_version'] = platform.mac_ver()[0]
        elif self.host['os_name'] == "Windows":
            os_version = platform.win32_ver()
            self.host['os_version'] = ' '.join(os_version[::2])
        else:

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