Handle calls to win32_ver from non-Windows platform

This commit is contained in:
Steve Dower 2015-09-22 17:35:24 -07:00
parent 64a3387d69
commit 8f278f1662
1 changed files with 4 additions and 1 deletions

View File

@ -546,7 +546,10 @@ def _get_real_winver(maj, min, build):
return maj, min, build return maj, min, build
def win32_ver(release='', version='', csd='', ptype=''): def win32_ver(release='', version='', csd='', ptype=''):
from sys import getwindowsversion try:
from sys import getwindowsversion
except ImportError:
return release, version, csd, ptype
try: try:
from winreg import OpenKeyEx, QueryValueEx, CloseKey, HKEY_LOCAL_MACHINE from winreg import OpenKeyEx, QueryValueEx, CloseKey, HKEY_LOCAL_MACHINE
except ImportError: except ImportError: