def checkEnvironment():
 if (sys.version_info[0:2] < (2, 4)):
  fatal('This script must be run with Python 2.4 or later')
 if (platform.system() != 'Darwin'):
  fatal('This script should be run on a Mac OS X 10.4 (or later) system')
 if (int(platform.release().split('.')[0]) < 8):
  fatal('This script should be run on a Mac OS X 10.4 (or later) system')
 if (not os.path.exists(SDKPATH)):
  fatal(('Please install the latest version of Xcode and the %s SDK' % os.path.basename(SDKPATH[:(-4)])))
 frameworks = {}
 for framework in ['Tcl', 'Tk']:
  fwpth = ('Library/Frameworks/%s.framework/Versions/Current' % framework)
  sysfw = os.path.join(SDKPATH, 'System', fwpth)
  libfw = os.path.join(SDKPATH, fwpth)
  usrfw = os.path.join(os.getenv('HOME'), fwpth)
  frameworks[framework] = os.readlink(sysfw)
  if (not os.path.exists(libfw)):
   fatal(('Please install a link to a current %s %s as %s so the user can override the system framework.' % (framework, frameworks[framework], libfw)))
  if (os.readlink(libfw) != os.readlink(sysfw)):
   fatal(('Version of %s must match %s' % (libfw, sysfw)))
  if os.path.exists(usrfw):
   fatal(('Please rename %s to avoid possible dynamic load issues.' % usrfw))
 if (frameworks['Tcl'] != frameworks['Tk']):
  fatal('The Tcl and Tk frameworks are not the same version.')
 EXPECTED_SHARED_LIBS['_tkinter.so'] = [('/Library/Frameworks/Tcl.framework/Versions/%s/Tcl' % frameworks['Tcl']), ('/Library/Frameworks/Tk.framework/Versions/%s/Tk' % frameworks['Tk'])]
 environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_', 'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
 for ev in list(os.environ):
  for prefix in environ_var_prefixes:
   if ev.startswith(prefix):
    print ('INFO: deleting environment variable %s=%s' % (ev, os.environ[ev]))
    del os.environ[ev]
 base_path = '/bin:/sbin:/usr/bin:/usr/sbin'
 if ('SDK_TOOLS_BIN' in os.environ):
  base_path = ((os.environ['SDK_TOOLS_BIN'] + ':') + base_path)
 OLD_DEVELOPER_TOOLS = '/Developer/Tools'
 if os.path.isdir(OLD_DEVELOPER_TOOLS):
  base_path = ((base_path + ':') + OLD_DEVELOPER_TOOLS)
 os.environ['PATH'] = base_path
 print ('Setting default PATH: %s' % os.environ['PATH'])
 runCommand('hg --version')
 runCommand('sphinx-build --version')

def checkEnvironment ( ) : if ( sys . version_info [ 0 : 2 ] < ( 2 , 4 ) ) : fatal ( 'This script must be run with Python 2.4 or later' ) if ( platform . system ( ) != 'Darwin' ) : fatal ( 'This script should be run on a Mac OS X 10.4 (or later) system' ) if ( int ( platform . release ( ) . split ( '.' ) [ 0 ] ) < 8 ) : fatal ( 'This script should be run on a Mac OS X 10.4 (or later) system' ) if ( not os . path . exists ( SDKPATH ) ) : fatal ( ( 'Please install the latest version of Xcode and the %s SDK' % os . path . basename ( SDKPATH [ : ( - 4 ) ] ) ) ) frameworks = { } for framework in [ 'Tcl' , 'Tk' ] : fwpth = ( 'Library/Frameworks/%s.framework/Versions/Current' % framework ) sysfw = os . path . join ( SDKPATH , 'System' , fwpth ) libfw = os . path . join ( SDKPATH , fwpth ) usrfw = os . path . join ( os . getenv ( 'HOME' ) , fwpth ) frameworks [ framework ] = os . readlink ( sysfw ) if ( not os . path . exists ( libfw ) ) : fatal ( ( 'Please install a link to a current %s %s as %s so the user can override the system framework.' % ( framework , frameworks [ framework ] , libfw ) ) ) if ( os . readlink ( libfw ) != os . readlink ( sysfw ) ) : fatal ( ( 'Version of %s must match %s' % ( libfw , sysfw ) ) ) if os . path . exists ( usrfw ) : fatal ( ( 'Please rename %s to avoid possible dynamic load issues.' % usrfw ) ) if ( frameworks [ 'Tcl' ] != frameworks [ 'Tk' ] ) : fatal ( 'The Tcl and Tk frameworks are not the same version.' ) EXPECTED_SHARED_LIBS [ '_tkinter.so' ] = [ ( '/Library/Frameworks/Tcl.framework/Versions/%s/Tcl' % frameworks [ 'Tcl' ] ) , ( '/Library/Frameworks/Tk.framework/Versions/%s/Tk' % frameworks [ 'Tk' ] ) ] environ_var_prefixes = [ 'CPATH' , 'C_INCLUDE_' , 'DYLD_' , 'LANG' , 'LC_' , 'LD_' , 'LIBRARY_' , 'PATH' , 'PYTHON' ] for ev in list ( os . environ ) : for prefix in environ_var_prefixes : if ev . startswith ( prefix ) : print ( 'INFO: deleting environment variable %s=%s' % ( ev , os . environ [ ev ] ) ) del os . environ [ ev ] base_path = '/bin:/sbin:/usr/bin:/usr/sbin' if ( 'SDK_TOOLS_BIN' in os . environ ) : base_path = ( ( os . environ [ 'SDK_TOOLS_BIN' ] + ':' ) + base_path ) OLD_DEVELOPER_TOOLS = '/Developer/Tools' if os . path . isdir ( OLD_DEVELOPER_TOOLS ) : base_path = ( ( base_path + ':' ) + OLD_DEVELOPER_TOOLS ) os . environ [ 'PATH' ] = base_path print ( 'Setting default PATH: %s' % os . environ [ 'PATH' ] ) runCommand ( 'hg --version' ) runCommand ( 'sphinx-build --version' )
check that were running on a supported system .