def CLTVersion():
 STANDALONE_PKG_ID = 'com.apple.pkg.DeveloperToolsCLILeo'
 FROM_XCODE_PKG_ID = 'com.apple.pkg.DeveloperToolsCLI'
 MAVERICKS_PKG_ID = 'com.apple.pkg.CLTools_Executables'
 regex = re.compile('version: (?P<version>.+)')
 for key in [MAVERICKS_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID]:
  try:
   output = GetStdout(['/usr/sbin/pkgutil', '--pkg-info', key])
   return re.search(regex, output).groupdict()['version']
  except:
   continue

def CLTVersion ( ) : STANDALONE_PKG_ID = 'com.apple.pkg.DeveloperToolsCLILeo' FROM_XCODE_PKG_ID = 'com.apple.pkg.DeveloperToolsCLI' MAVERICKS_PKG_ID = 'com.apple.pkg.CLTools_Executables' regex = re . compile ( 'version: (?P<version>.+)' ) for key in [ MAVERICKS_PKG_ID , STANDALONE_PKG_ID , FROM_XCODE_PKG_ID ] : try : output = GetStdout ( [ '/usr/sbin/pkgutil' , '--pkg-info' , key ] ) return re . search ( regex , output ) . groupdict ( ) [ 'version' ] except : continue
returns the version of command-line tools from pkgutil .