def get_python_os_info():
 info = platform.system_alias(platform.system(), platform.release(), platform.version())
 (os_type, os_ver, _) = info
 os_type = os_type.lower()
 if os_type.startswith('linux'):
  info = platform.linux_distribution()
  if info[0]:
   os_type = info[0]
  if info[1]:
   os_ver = info[1]
 elif os_type.startswith('darwin'):
  os_ver = subprocess.Popen(['sw_vers', '-productVersion'], stdout=subprocess.PIPE).communicate()[0].rstrip('\n')
 elif os_type.startswith('freebsd'):
  os_ver = os_ver.partition('-')[0]
  os_ver = os_ver.partition('.')[0]
 elif platform.win32_ver()[1]:
  os_ver = platform.win32_ver()[1]
 else:
  os_ver = ''
 return (os_type, os_ver)

def get_python_os_info ( ) : info = platform . system_alias ( platform . system ( ) , platform . release ( ) , platform . version ( ) ) ( os_type , os_ver , _ ) = info os_type = os_type . lower ( ) if os_type . startswith ( 'linux' ) : info = platform . linux_distribution ( ) if info [ 0 ] : os_type = info [ 0 ] if info [ 1 ] : os_ver = info [ 1 ] elif os_type . startswith ( 'darwin' ) : os_ver = subprocess . Popen ( [ 'sw_vers' , '-productVersion' ] , stdout = subprocess . PIPE ) . communicate ( ) [ 0 ] . rstrip ( '\n' ) elif os_type . startswith ( 'freebsd' ) : os_ver = os_ver . partition ( '-' ) [ 0 ] os_ver = os_ver . partition ( '.' ) [ 0 ] elif platform . win32_ver ( ) [ 1 ] : os_ver = platform . win32_ver ( ) [ 1 ] else : os_ver = '' return ( os_type , os_ver )
get operating system type/distribution and major version using python platform module :returns: :rtype: tuple of str .