def _is_64bit_windows(): p = sys.platform from win32process import IsWow64Process if p == 'win64' or (p == 'win32' and IsWow64Process()): return True elif p == 'win32': return False else: raise Exception( _("WindowsDistribution may only be used on the Windows platform" ))
try: _uname = os.uname() # On Darwin, machine is wrong. if _uname[0] == 'Darwin' and _uname[-1] == 'i386': _cpu64 = os.popen('sysctl -n hw.cpu64bit_capable 2>&1').next().strip() if _cpu64 == '1': _uname = tuple(list(_uname[:-1]) + ['x86_64']) except AttributeError: # No uname. Probably Windows. import sys p = sys.platform if p == 'win64': _uname = ('Windows', 'x86_64') elif p == 'win32': from win32process import IsWow64Process if IsWow64Process(): _uname = ('Windows', 'x86_64') else: _uname = ('Windows', 'i486') else: _uname = (p, 'i486') def canonicalize_os(os_): """@type os_: str @rtype: str""" if os_.startswith('CYGWIN_NT'): os_ = 'Cygwin' elif os_ == 'SunOS': os_ = 'Solaris' return os_