parameters: ()
docstring: Modifies existing classes and methods to enable error verification
docstring_summary: Modifies existing classes and methods to enable error verification
docstring_tokens: Modifies existing classes and methods to enable error verification
function: def enhance_lib():
  	"""
  	Modifies existing classes and methods to enable error verification
  	"""
  	for m in meths_typos:
  		replace(m)
  
  	# catch '..' in ant_glob patterns
  	def ant_glob(self, *k, **kw):
  		if k:
  			lst = Utils.to_list(k[0])
  			for pat in lst:
  				sp = pat.split('/')
  				if '..' in sp:
  					Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'", k[0])
  				if '.' in sp:
  					Logs.error("In ant_glob pattern %r: '.' means 'one dot', not 'current directory'", k[0])
  		return self.old_ant_glob(*k, **kw)
  	Node.Node.old_ant_glob = Node.Node.ant_glob
  	Node.Node.ant_glob = ant_glob
  
  	# catch ant_glob on build folders
  	def ant_iter(self, accept=None, maxdepth=25, pats=[], dir=False, src=True, remove=True, quiet=False):
  		if remove:
  			try:
  				if self.is_child_of(self.ctx.bldnode) and not quiet:
  					quiet = True
  					Logs.error('Calling ant_glob on build folders (%r) is dangerous: add quiet=True / remove=False', self)
  			except AttributeError:
  				pass
  		return self.old_ant_iter(accept, maxdepth, pats, dir, src, remove, quiet)
  	Node.Node.old_ant_iter = Node.Node.ant_iter
  	Node.Node.ant_iter = ant_iter
  
  	# catch conflicting ext_in/ext_out/before/after declarations
  	old = Task.is_before
  	def is_before(t1, t2):
  		ret = old(t1, t2)
  		if ret and old(t2, t1):
  			Logs.error('Contradictory order constraints in classes %r %r', t1, t2)
  		return ret
  	Task.is_before = is_before
  
  	# check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose
  	# so we only issue a warning
  	def check_err_features(self):
  		lst = self.to_list(self.features)
  		if 'shlib' in lst:
  			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
  		for x in ('c', 'cxx', 'd', 'fc'):
  			if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]:
  				Logs.error('%r features is probably missing %r', self, x)
  	TaskGen.feature('*')(check_err_features)
  
  	# check for erroneous order constraints
  	def check_err_order(self):
  		if not hasattr(self, 'rule') and not 'subst' in Utils.to_list(self.features):
  			for x in ('before', 'after', 'ext_in', 'ext_out'):
  				if hasattr(self, x):
  					Logs.warn('Erroneous order constraint %r on non-rule based task generator %r', x, self)
  		else:
  			for x in ('before', 'after'):
  				for y in self.to_list(getattr(self, x, [])):
  					if not Task.classes.get(y):
  						Logs.error('Erroneous order constraint %s=%r on %r (no such class)', x, y, self)
  	TaskGen.feature('*')(check_err_order)
  
  	# check for @extension used with @feature/@before_method/@after_method
  	def check_compile(self):
  		check_invalid_constraints(self)
  		try:
  			ret = self.orig_compile()
  		finally:
  			check_same_targets(self)
  		return ret
  	Build.BuildContext.orig_compile = Build.BuildContext.compile
  	Build.BuildContext.compile = check_compile
  
  	# check for invalid build groups #914
  	def use_rec(self, name, **kw):
  		try:
  			y = self.bld.get_tgen_by_name(name)
  		except Errors.WafError:
  			pass
  		else:
  			idx = self.bld.get_group_idx(self)
  			odx = self.bld.get_group_idx(y)
  			if odx > idx:
  				msg = "Invalid 'use' across build groups:"
  				if Logs.verbose > 1:
  					msg += '\n  target %r\n  uses:\n  %r' % (self, y)
  				else:
  					msg += " %r uses %r (try 'waf -v -v' for the full error)" % (self.name, name)
  				raise Errors.WafError(msg)
  		self.orig_use_rec(name, **kw)
  	TaskGen.task_gen.orig_use_rec = TaskGen.task_gen.use_rec
  	TaskGen.task_gen.use_rec = use_rec
  
  	# check for env.append
  	def _getattr(self, name, default=None):
  		if name == 'append' or name == 'add':
  			raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique')
  		elif name == 'prepend':
  			raise Errors.WafError('env.prepend does not exist: use env.prepend_value')
  		if name in self.__slots__:
  			return super(ConfigSet.ConfigSet, self).__getattr__(name, default)
  		else:
  			return self[name]
  	ConfigSet.ConfigSet.__getattr__ = _getattr
function_tokens: def enhance_lib ( ) : for m in meths_typos : replace ( m ) # catch '..' in ant_glob patterns def ant_glob ( self , * k , * * kw ) : if k : lst = Utils . to_list ( k [ 0 ] ) for pat in lst : sp = pat . split ( '/' ) if '..' in sp : Logs . error ( "In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" , k [ 0 ] ) if '.' in sp : Logs . error ( "In ant_glob pattern %r: '.' means 'one dot', not 'current directory'" , k [ 0 ] ) return self . old_ant_glob ( * k , * * kw ) Node . Node . old_ant_glob = Node . Node . ant_glob Node . Node . ant_glob = ant_glob # catch ant_glob on build folders def ant_iter ( self , accept = None , maxdepth = 25 , pats = [ ] , dir = False , src = True , remove = True , quiet = False ) : if remove : try : if self . is_child_of ( self . ctx . bldnode ) and not quiet : quiet = True Logs . error ( 'Calling ant_glob on build folders (%r) is dangerous: add quiet=True / remove=False' , self ) except AttributeError : pass return self . old_ant_iter ( accept , maxdepth , pats , dir , src , remove , quiet ) Node . Node . old_ant_iter = Node . Node . ant_iter Node . Node . ant_iter = ant_iter # catch conflicting ext_in/ext_out/before/after declarations old = Task . is_before def is_before ( t1 , t2 ) : ret = old ( t1 , t2 ) if ret and old ( t2 , t1 ) : Logs . error ( 'Contradictory order constraints in classes %r %r' , t1 , t2 ) return ret Task . is_before = is_before # check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose # so we only issue a warning def check_err_features ( self ) : lst = self . to_list ( self . features ) if 'shlib' in lst : Logs . error ( 'feature shlib -> cshlib, dshlib or cxxshlib' ) for x in ( 'c' , 'cxx' , 'd' , 'fc' ) : if not x in lst and lst and lst [ 0 ] in [ x + y for y in ( 'program' , 'shlib' , 'stlib' ) ] : Logs . error ( '%r features is probably missing %r' , self , x ) TaskGen . feature ( '*' ) ( check_err_features ) # check for erroneous order constraints def check_err_order ( self ) : if not hasattr ( self , 'rule' ) and not 'subst' in Utils . to_list ( self . features ) : for x in ( 'before' , 'after' , 'ext_in' , 'ext_out' ) : if hasattr ( self , x ) : Logs . warn ( 'Erroneous order constraint %r on non-rule based task generator %r' , x , self ) else : for x in ( 'before' , 'after' ) : for y in self . to_list ( getattr ( self , x , [ ] ) ) : if not Task . classes . get ( y ) : Logs . error ( 'Erroneous order constraint %s=%r on %r (no such class)' , x , y , self ) TaskGen . feature ( '*' ) ( check_err_order ) # check for @extension used with @feature/@before_method/@after_method def check_compile ( self ) : check_invalid_constraints ( self ) try : ret = self . orig_compile ( ) finally : check_same_targets ( self ) return ret Build . BuildContext . orig_compile = Build . BuildContext . compile Build . BuildContext . compile = check_compile # check for invalid build groups #914 def use_rec ( self , name , * * kw ) : try : y = self . bld . get_tgen_by_name ( name ) except Errors . WafError : pass else : idx = self . bld . get_group_idx ( self ) odx = self . bld . get_group_idx ( y ) if odx > idx : msg = "Invalid 'use' across build groups:" if Logs . verbose > 1 : msg += '\n  target %r\n  uses:\n  %r' % ( self , y ) else : msg += " %r uses %r (try 'waf -v -v' for the full error)" % ( self . name , name ) raise Errors . WafError ( msg ) self . orig_use_rec ( name , * * kw ) TaskGen . task_gen . orig_use_rec = TaskGen . task_gen . use_rec TaskGen . task_gen . use_rec = use_rec # check for env.append def _getattr ( self , name , default = None ) : if name == 'append' or name == 'add' : raise Errors . WafError ( 'env.append and env.add do not exist: use env.append_value/env.append_unique' ) elif name == 'prepend' : raise Errors . WafError ( 'env.prepend does not exist: use env.prepend_value' ) if name in self . __slots__ : return super ( ConfigSet . ConfigSet , self ) . __getattr__ ( name , default ) else : return self [ name ] ConfigSet . ConfigSet . __getattr__ = _getattr