parameters: (self, filename, **kw)
return_statement: return ret
docstring: Search for a program on the operating system
  
  	When var is used, you may set os.environ[var] to help find a specific program version, for example::
  
  		$ CC='ccache gcc' waf configure
  
  	:param path_list: paths to use for searching
  	:type param_list: list of string
  	:param var: store the result to conf.env[var] where var defaults to filename.upper() if not provided; the result is stored as a list of strings
  	:type var: string
  	:param value: obtain the program from the value passed exclusively
  	:type value: list or string (list is preferred)
  	:param exts: list of extensions for the binary (do not add an extension for portability)
  	:type exts: list of string
  	:param msg: name to display in the log, by default filename is used
  	:type msg: string
  	:param interpreter: interpreter for the program
  	:type interpreter: ConfigSet variable key
  	:raises: :py:class:`waflib.Errors.ConfigurationError`
docstring_summary: Search for a program on the operating system
docstring_tokens: Search for a program on the operating system
function: def find_program(self, filename, **kw):
  	"""
  	Search for a program on the operating system
  
  	When var is used, you may set os.environ[var] to help find a specific program version, for example::
  
  		$ CC='ccache gcc' waf configure
  
  	:param path_list: paths to use for searching
  	:type param_list: list of string
  	:param var: store the result to conf.env[var] where var defaults to filename.upper() if not provided; the result is stored as a list of strings
  	:type var: string
  	:param value: obtain the program from the value passed exclusively
  	:type value: list or string (list is preferred)
  	:param exts: list of extensions for the binary (do not add an extension for portability)
  	:type exts: list of string
  	:param msg: name to display in the log, by default filename is used
  	:type msg: string
  	:param interpreter: interpreter for the program
  	:type interpreter: ConfigSet variable key
  	:raises: :py:class:`waflib.Errors.ConfigurationError`
  	"""
  
  	exts = kw.get('exts', Utils.is_win32 and '.exe,.com,.bat,.cmd' or ',.sh,.pl,.py')
  
  	environ = kw.get('environ', getattr(self, 'environ', os.environ))
  
  	ret = ''
  
  	filename = Utils.to_list(filename)
  	msg = kw.get('msg', ', '.join(filename))
  
  	var = kw.get('var', '')
  	if not var:
  		var = re.sub(r'[-.]', '_', filename[0].upper())
  
  	path_list = kw.get('path_list', '')
  	if path_list:
  		path_list = Utils.to_list(path_list)
  	else:
  		path_list = environ.get('PATH', '').split(os.pathsep)
  
  	if kw.get('value'):
  		# user-provided in command-line options and passed to find_program
  		ret = self.cmd_to_list(kw['value'])
  	elif environ.get(var):
  		# user-provided in the os environment
  		ret = self.cmd_to_list(environ[var])
  	elif self.env[var]:
  		# a default option in the wscript file
  		ret = self.cmd_to_list(self.env[var])
  	else:
  		if not ret:
  			ret = self.find_binary(filename, exts.split(','), path_list)
  		if not ret and Utils.winreg:
  			ret = Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER, filename)
  		if not ret and Utils.winreg:
  			ret = Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE, filename)
  		ret = self.cmd_to_list(ret)
  
  	if ret:
  		if len(ret) == 1:
  			retmsg = ret[0]
  		else:
  			retmsg = ret
  	else:
  		retmsg = False
  
  	self.msg('Checking for program %r' % msg, retmsg, **kw)
  	if not kw.get('quiet'):
  		self.to_log('find program=%r paths=%r var=%r -> %r' % (filename, path_list, var, ret))
  
  	if not ret:
  		self.fatal(kw.get('errmsg', '') or 'Could not find the program %r' % filename)
  
  	interpreter = kw.get('interpreter')
  	if interpreter is None:
  		if not Utils.check_exe(ret[0], env=environ):
  			self.fatal('Program %r is not executable' % ret)
  		self.env[var] = ret
  	else:
  		self.env[var] = self.env[interpreter] + ret
  
  	return ret
function_tokens: def find_program ( self , filename , * * kw ) : exts = kw . get ( 'exts' , Utils . is_win32 and '.exe,.com,.bat,.cmd' or ',.sh,.pl,.py' ) environ = kw . get ( 'environ' , getattr ( self , 'environ' , os . environ ) ) ret = '' filename = Utils . to_list ( filename ) msg = kw . get ( 'msg' , ', ' . join ( filename ) ) var = kw . get ( 'var' , '' ) if not var : var = re . sub ( r'[-.]' , '_' , filename [ 0 ] . upper ( ) ) path_list = kw . get ( 'path_list' , '' ) if path_list : path_list = Utils . to_list ( path_list ) else : path_list = environ . get ( 'PATH' , '' ) . split ( os . pathsep ) if kw . get ( 'value' ) : # user-provided in command-line options and passed to find_program ret = self . cmd_to_list ( kw [ 'value' ] ) elif environ . get ( var ) : # user-provided in the os environment ret = self . cmd_to_list ( environ [ var ] ) elif self . env [ var ] : # a default option in the wscript file ret = self . cmd_to_list ( self . env [ var ] ) else : if not ret : ret = self . find_binary ( filename , exts . split ( ',' ) , path_list ) if not ret and Utils . winreg : ret = Utils . get_registry_app_path ( Utils . winreg . HKEY_CURRENT_USER , filename ) if not ret and Utils . winreg : ret = Utils . get_registry_app_path ( Utils . winreg . HKEY_LOCAL_MACHINE , filename ) ret = self . cmd_to_list ( ret ) if ret : if len ( ret ) == 1 : retmsg = ret [ 0 ] else : retmsg = ret else : retmsg = False self . msg ( 'Checking for program %r' % msg , retmsg , * * kw ) if not kw . get ( 'quiet' ) : self . to_log ( 'find program=%r paths=%r var=%r -> %r' % ( filename , path_list , var , ret ) ) if not ret : self . fatal ( kw . get ( 'errmsg' , '' ) or 'Could not find the program %r' % filename ) interpreter = kw . get ( 'interpreter' ) if interpreter is None : if not Utils . check_exe ( ret [ 0 ] , env = environ ) : self . fatal ( 'Program %r is not executable' % ret ) self . env [ var ] = ret else : self . env [ var ] = self . env [ interpreter ] + ret return ret