mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Fix lint
This commit is contained in:
parent
5789ea99cf
commit
04c4ec4f81
@ -3,29 +3,35 @@
|
||||
Get Versioning information from Windows
|
||||
'''
|
||||
# http://stackoverflow.com/questions/32300004/python-ctypes-getting-0-with-getversionex-function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import ctypes
|
||||
from ctypes.wintypes import BYTE, WORD, DWORD, WCHAR
|
||||
|
||||
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
|
||||
|
||||
|
||||
class OSVERSIONINFO(ctypes.Structure):
|
||||
_fields_ = (('dwOSVersionInfoSize', DWORD),
|
||||
('dwMajorVersion', DWORD),
|
||||
('dwMinorVersion', DWORD),
|
||||
('dwBuildNumber', DWORD),
|
||||
('dwPlatformId', DWORD),
|
||||
('szCSDVersion', WCHAR * 128))
|
||||
('dwMajorVersion', DWORD),
|
||||
('dwMinorVersion', DWORD),
|
||||
('dwBuildNumber', DWORD),
|
||||
('dwPlatformId', DWORD),
|
||||
('szCSDVersion', WCHAR * 128))
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
super(OSVERSIONINFO, self).__init__(*args, **kwds)
|
||||
self.dwOSVersionInfoSize = ctypes.sizeof(self)
|
||||
kernel32.GetVersionExW(ctypes.byref(self))
|
||||
|
||||
|
||||
class OSVERSIONINFOEX(OSVERSIONINFO):
|
||||
_fields_ = (('wServicePackMajor', WORD),
|
||||
('wServicePackMinor', WORD),
|
||||
('wSuiteMask', WORD),
|
||||
('wProductType', BYTE),
|
||||
('wReserved', BYTE))
|
||||
('wSuiteMask', WORD),
|
||||
('wProductType', BYTE),
|
||||
('wReserved', BYTE))
|
||||
|
||||
|
||||
def errcheck_bool(result, func, args):
|
||||
if not result:
|
||||
@ -35,6 +41,7 @@ def errcheck_bool(result, func, args):
|
||||
kernel32.GetVersionExW.errcheck = errcheck_bool
|
||||
kernel32.GetVersionExW.argtypes = (ctypes.POINTER(OSVERSIONINFO),)
|
||||
|
||||
|
||||
def get_os_version_info():
|
||||
info = OSVERSIONINFOEX()
|
||||
ret = {'MajorVersion': info.dwMajorVersion,
|
||||
|
Loading…
Reference in New Issue
Block a user