def mac_ver(release='', versioninfo=('', '', ''), machine=''):
 try:
  import gestalt
  import MacOS
 except ImportError:
  return (release, versioninfo, machine)
 (sysv, sysu, sysa) = _mac_ver_lookup(('sysv', 'sysu', 'sysa'))
 if sysv:
  major = ((sysv & 65280) >> 8)
  minor = ((sysv & 240) >> 4)
  patch = (sysv & 15)
  if ((major, minor) >= (10, 4)):
   (major, minor, patch) = _mac_ver_lookup(('sys1', 'sys2', 'sys3'))
   release = ('%i.%i.%i' % (major, minor, patch))
  else:
   release = ('%s.%i.%i' % (_bcd2str(major), minor, patch))
 if sysu:
  major = int(((sysu & 4278190080L) >> 24))
  minor = ((sysu & 15728640) >> 20)
  bugfix = ((sysu & 983040) >> 16)
  stage = ((sysu & 65280) >> 8)
  nonrel = (sysu & 255)
  version = ('%s.%i.%i' % (_bcd2str(major), minor, bugfix))
  nonrel = _bcd2str(nonrel)
  stage = {32: 'development', 64: 'alpha', 96: 'beta', 128: 'final'}.get(stage, '')
  versioninfo = (version, stage, nonrel)
 if sysa:
  machine = {1: '68k', 2: 'PowerPC', 10: 'i386'}.get(sysa, '')
 return (release, versioninfo, machine)

def mac_ver ( release = '' , versioninfo = ( '' , '' , '' ) , machine = '' ) : try : import gestalt import MacOS except ImportError : return ( release , versioninfo , machine ) ( sysv , sysu , sysa ) = _mac_ver_lookup ( ( 'sysv' , 'sysu' , 'sysa' ) ) if sysv : major = ( ( sysv & 65280 ) >> 8 ) minor = ( ( sysv & 240 ) >> 4 ) patch = ( sysv & 15 ) if ( ( major , minor ) >= ( 10 , 4 ) ) : ( major , minor , patch ) = _mac_ver_lookup ( ( 'sys1' , 'sys2' , 'sys3' ) ) release = ( '%i.%i.%i' % ( major , minor , patch ) ) else : release = ( '%s.%i.%i' % ( _bcd2str ( major ) , minor , patch ) ) if sysu : major = int ( ( ( sysu & 4278190080 L ) >> 24 ) ) minor = ( ( sysu & 15728640 ) >> 20 ) bugfix = ( ( sysu & 983040 ) >> 16 ) stage = ( ( sysu & 65280 ) >> 8 ) nonrel = ( sysu & 255 ) version = ( '%s.%i.%i' % ( _bcd2str ( major ) , minor , bugfix ) ) nonrel = _bcd2str ( nonrel ) stage = { 32 : 'development' , 64 : 'alpha' , 96 : 'beta' , 128 : 'final' } . get ( stage , '' ) versioninfo = ( version , stage , nonrel ) if sysa : machine = { 1 : '68k' , 2 : 'PowerPC' , 10 : 'i386' } . get ( sysa , '' ) return ( release , versioninfo , machine )
get macos version information and return it as tuple with versioninfo being a tuple .