parameters: (conf, module_name, condition='')
docstring: Check if the selected python interpreter can import the given python module::
  
  		def configure(conf):
  			conf.check_python_module('pygccxml')
  			conf.check_python_module('re', condition="ver > num(2, 0, 4) and ver <= num(3, 0, 0)")
  
  	:param module_name: module
  	:type module_name: string
docstring_summary: Check if the selected python interpreter can import the given python module::
docstring_tokens: Check if the selected python interpreter can import the given python module ::
function: def check_python_module(conf, module_name, condition=''):
  	"""
  	Check if the selected python interpreter can import the given python module::
  
  		def configure(conf):
  			conf.check_python_module('pygccxml')
  			conf.check_python_module('re', condition="ver > num(2, 0, 4) and ver <= num(3, 0, 0)")
  
  	:param module_name: module
  	:type module_name: string
  	"""
  	msg = "Checking for python module %r" % module_name
  	if condition:
  		msg = '%s (%s)' % (msg, condition)
  	conf.start_msg(msg)
  	try:
  		ret = conf.cmd_and_log(conf.env.PYTHON + ['-c', PYTHON_MODULE_TEMPLATE % module_name])
  	except Errors.WafError:
  		conf.end_msg(False)
  		conf.fatal('Could not find the python module %r' % module_name)
  
  	ret = ret.strip()
  	if condition:
  		conf.end_msg(ret)
  		if ret == 'unknown version':
  			conf.fatal('Could not check the %s version' % module_name)
  
  		from distutils.version import LooseVersion
  		def num(*k):
  			if isinstance(k[0], int):
  				return LooseVersion('.'.join([str(x) for x in k]))
  			else:
  				return LooseVersion(k[0])
  		d = {'num': num, 'ver': LooseVersion(ret)}
  		ev = eval(condition, {}, d)
  		if not ev:
  			conf.fatal('The %s version does not satisfy the requirements' % module_name)
  	else:
  		if ret == 'unknown version':
  			conf.end_msg(True)
  		else:
  			conf.end_msg(ret)
function_tokens: def check_python_module ( conf , module_name , condition = '' ) : msg = "Checking for python module %r" % module_name if condition : msg = '%s (%s)' % ( msg , condition ) conf . start_msg ( msg ) try : ret = conf . cmd_and_log ( conf . env . PYTHON + [ '-c' , PYTHON_MODULE_TEMPLATE % module_name ] ) except Errors . WafError : conf . end_msg ( False ) conf . fatal ( 'Could not find the python module %r' % module_name ) ret = ret . strip ( ) if condition : conf . end_msg ( ret ) if ret == 'unknown version' : conf . fatal ( 'Could not check the %s version' % module_name ) from distutils . version import LooseVersion def num ( * k ) : if isinstance ( k [ 0 ] , int ) : return LooseVersion ( '.' . join ( [ str ( x ) for x in k ] ) ) else : return LooseVersion ( k [ 0 ] ) d = { 'num' : num , 'ver' : LooseVersion ( ret ) } ev = eval ( condition , { } , d ) if not ev : conf . fatal ( 'The %s version does not satisfy the requirements' % module_name ) else : if ret == 'unknown version' : conf . end_msg ( True ) else : conf . end_msg ( ret )