parameters: (self, kw)
return_statement: return ret
docstring: Executes ``pkg-config`` or other ``-config`` applications to collect configuration flags:
  
  	* if atleast_pkgconfig_version is given, check that pkg-config has the version n and return
  	* if modversion is given, then return the module version
  	* else, execute the *-config* program with the *args* and *variables* given, and set the flags on the *conf.env.FLAGS_name* variable
  
  	:param path: the **-config program to use**
  	:type path: list of string
  	:param atleast_pkgconfig_version: minimum pkg-config version to use (disable other tests)
  	:type atleast_pkgconfig_version: string
  	:param package: package name, for example *gtk+-2.0*
  	:type package: string
  	:param uselib_store: if the test is successful, define HAVE\\_*name*. It is also used to define *conf.env.FLAGS_name* variables.
  	:type uselib_store: string
  	:param modversion: if provided, return the version of the given module and define *name*\\_VERSION
  	:type modversion: string
  	:param args: arguments to give to *package* when retrieving flags
  	:type args: list of string
  	:param variables: return the values of particular variables
  	:type variables: list of string
  	:param define_variable: additional variables to define (also in conf.env.PKG_CONFIG_DEFINES)
  	:type define_variable: dict(string: string)
  	:param pkg_config_path: paths where pkg-config should search for .pc config files (overrides env.PKG_CONFIG_PATH if exists)
  	:type pkg_config_path: string, list of directories separated by colon
  	:param force_static: force usage of static libraries
  	:type force_static: bool default False
  	:param posix: usage of POSIX mode for shlex lexical analiysis library
  	:type posix: bool default True
docstring_summary: Executes ``pkg-config`` or other ``-config`` applications to collect configuration flags:
docstring_tokens: Executes pkg - config or other - config applications to collect configuration flags :
function: def exec_cfg(self, kw):
  	"""
  	Executes ``pkg-config`` or other ``-config`` applications to collect configuration flags:
  
  	* if atleast_pkgconfig_version is given, check that pkg-config has the version n and return
  	* if modversion is given, then return the module version
  	* else, execute the *-config* program with the *args* and *variables* given, and set the flags on the *conf.env.FLAGS_name* variable
  
  	:param path: the **-config program to use**
  	:type path: list of string
  	:param atleast_pkgconfig_version: minimum pkg-config version to use (disable other tests)
  	:type atleast_pkgconfig_version: string
  	:param package: package name, for example *gtk+-2.0*
  	:type package: string
  	:param uselib_store: if the test is successful, define HAVE\\_*name*. It is also used to define *conf.env.FLAGS_name* variables.
  	:type uselib_store: string
  	:param modversion: if provided, return the version of the given module and define *name*\\_VERSION
  	:type modversion: string
  	:param args: arguments to give to *package* when retrieving flags
  	:type args: list of string
  	:param variables: return the values of particular variables
  	:type variables: list of string
  	:param define_variable: additional variables to define (also in conf.env.PKG_CONFIG_DEFINES)
  	:type define_variable: dict(string: string)
  	:param pkg_config_path: paths where pkg-config should search for .pc config files (overrides env.PKG_CONFIG_PATH if exists)
  	:type pkg_config_path: string, list of directories separated by colon
  	:param force_static: force usage of static libraries
  	:type force_static: bool default False
  	:param posix: usage of POSIX mode for shlex lexical analiysis library
  	:type posix: bool default True
  	"""
  
  	path = Utils.to_list(kw['path'])
  	env = self.env.env or None
  	if kw.get('pkg_config_path'):
  		if not env:
  			env = dict(self.environ)
  		env['PKG_CONFIG_PATH'] = kw['pkg_config_path']
  
  	def define_it():
  		define_name = kw['define_name']
  		# by default, add HAVE_X to the config.h, else provide DEFINES_X for use=X
  		if kw.get('global_define', 1):
  			self.define(define_name, 1, False)
  		else:
  			self.env.append_unique('DEFINES_%s' % kw['uselib_store'], "%s=1" % define_name)
  
  		if kw.get('add_have_to_env', 1):
  			self.env[define_name] = 1
  
  	# pkg-config version
  	if 'atleast_pkgconfig_version' in kw:
  		cmd = path + ['--atleast-pkgconfig-version=%s' % kw['atleast_pkgconfig_version']]
  		self.cmd_and_log(cmd, env=env)
  		return
  
  	# single version for a module
  	if 'modversion' in kw:
  		version = self.cmd_and_log(path + ['--modversion', kw['modversion']], env=env).strip()
  		if not 'okmsg' in kw:
  			kw['okmsg'] = version
  		self.define(kw['define_name'], version)
  		return version
  
  	lst = [] + path
  
  	defi = kw.get('define_variable')
  	if not defi:
  		defi = self.env.PKG_CONFIG_DEFINES or {}
  	for key, val in defi.items():
  		lst.append('--define-variable=%s=%s' % (key, val))
  
  	static = kw.get('force_static', False)
  	if 'args' in kw:
  		args = Utils.to_list(kw['args'])
  		if '--static' in args or '--static-libs' in args:
  			static = True
  		lst += args
  
  	# tools like pkgconf expect the package argument after the -- ones -_-
  	lst.extend(Utils.to_list(kw['package']))
  
  	# retrieving variables of a module
  	if 'variables' in kw:
  		v_env = kw.get('env', self.env)
  		vars = Utils.to_list(kw['variables'])
  		for v in vars:
  			val = self.cmd_and_log(lst + ['--variable=' + v], env=env).strip()
  			var = '%s_%s' % (kw['uselib_store'], v)
  			v_env[var] = val
  		return
  
  	# so we assume the command-line will output flags to be parsed afterwards
  	ret = self.cmd_and_log(lst, env=env)
  
  	define_it()
  	self.parse_flags(ret, kw['uselib_store'], kw.get('env', self.env), force_static=static, posix=kw.get('posix'))
  	return ret
function_tokens: def exec_cfg ( self , kw ) : path = Utils . to_list ( kw [ 'path' ] ) env = self . env . env or None if kw . get ( 'pkg_config_path' ) : if not env : env = dict ( self . environ ) env [ 'PKG_CONFIG_PATH' ] = kw [ 'pkg_config_path' ] def define_it ( ) : define_name = kw [ 'define_name' ] # by default, add HAVE_X to the config.h, else provide DEFINES_X for use=X if kw . get ( 'global_define' , 1 ) : self . define ( define_name , 1 , False ) else : self . env . append_unique ( 'DEFINES_%s' % kw [ 'uselib_store' ] , "%s=1" % define_name ) if kw . get ( 'add_have_to_env' , 1 ) : self . env [ define_name ] = 1 # pkg-config version if 'atleast_pkgconfig_version' in kw : cmd = path + [ '--atleast-pkgconfig-version=%s' % kw [ 'atleast_pkgconfig_version' ] ] self . cmd_and_log ( cmd , env = env ) return # single version for a module if 'modversion' in kw : version = self . cmd_and_log ( path + [ '--modversion' , kw [ 'modversion' ] ] , env = env ) . strip ( ) if not 'okmsg' in kw : kw [ 'okmsg' ] = version self . define ( kw [ 'define_name' ] , version ) return version lst = [ ] + path defi = kw . get ( 'define_variable' ) if not defi : defi = self . env . PKG_CONFIG_DEFINES or { } for key , val in defi . items ( ) : lst . append ( '--define-variable=%s=%s' % ( key , val ) ) static = kw . get ( 'force_static' , False ) if 'args' in kw : args = Utils . to_list ( kw [ 'args' ] ) if '--static' in args or '--static-libs' in args : static = True lst += args # tools like pkgconf expect the package argument after the -- ones -_- lst . extend ( Utils . to_list ( kw [ 'package' ] ) ) # retrieving variables of a module if 'variables' in kw : v_env = kw . get ( 'env' , self . env ) vars = Utils . to_list ( kw [ 'variables' ] ) for v in vars : val = self . cmd_and_log ( lst + [ '--variable=' + v ] , env = env ) . strip ( ) var = '%s_%s' % ( kw [ 'uselib_store' ] , v ) v_env [ var ] = val return # so we assume the command-line will output flags to be parsed afterwards ret = self . cmd_and_log ( lst , env = env ) define_it ( ) self . parse_flags ( ret , kw [ 'uselib_store' ] , kw . get ( 'env' , self . env ) , force_static = static , posix = kw . get ( 'posix' ) ) return ret