def find_executable( executable_name, env_variable, test_args, error_message ): print "Looking for %s ..." % executable_name if os.environ.has_key( env_variable ): specified = os.environ[ env_variable ] print " Trying %s specified in env. variable %s" % ( specified, env_variable ) if os.path.exists( specified ): return specified.replace( "\\", "/" ) else: print "Cannot find %s specified in env. variable %s" % ( specified, env_variable ) rc = checked_system.system( [ "%s %s" % ( executable_name, test_args ) ] ) print "" if rc != 0: print error_message return None else: return executable_name.replace( "\\", "/" )