parameters: (self)
docstring: Define a transformation that substitutes the contents of *source* files to *target* files::
  
  		def build(bld):
  			bld(
  				features='subst',
  				source='foo.c.in',
  				target='foo.c',
  				install_path='${LIBDIR}/pkgconfig',
  				VAR = 'val'
  			)
  
  	The input files are supposed to contain macros of the form *@VAR@*, where *VAR* is an argument
  	of the task generator object.
  
  	This method overrides the processing by :py:meth:`waflib.TaskGen.process_source`.
docstring_summary: Define a transformation that substitutes the contents of *source* files to *target* files::
docstring_tokens: Define a transformation that substitutes the contents of * source * files to * target * files ::
function: def process_subst(self):
  	"""
  	Define a transformation that substitutes the contents of *source* files to *target* files::
  
  		def build(bld):
  			bld(
  				features='subst',
  				source='foo.c.in',
  				target='foo.c',
  				install_path='${LIBDIR}/pkgconfig',
  				VAR = 'val'
  			)
  
  	The input files are supposed to contain macros of the form *@VAR@*, where *VAR* is an argument
  	of the task generator object.
  
  	This method overrides the processing by :py:meth:`waflib.TaskGen.process_source`.
  	"""
  
  	src = Utils.to_list(getattr(self, 'source', []))
  	if isinstance(src, Node.Node):
  		src = [src]
  	tgt = Utils.to_list(getattr(self, 'target', []))
  	if isinstance(tgt, Node.Node):
  		tgt = [tgt]
  	if len(src) != len(tgt):
  		raise Errors.WafError('invalid number of source/target for %r' % self)
  
  	for x, y in zip(src, tgt):
  		if not x or not y:
  			raise Errors.WafError('null source or target for %r' % self)
  		a, b = None, None
  
  		if isinstance(x, str) and isinstance(y, str) and x == y:
  			a = self.path.find_node(x)
  			b = self.path.get_bld().make_node(y)
  			if not os.path.isfile(b.abspath()):
  				b.sig = None
  				b.parent.mkdir()
  		else:
  			if isinstance(x, str):
  				a = self.path.find_resource(x)
  			elif isinstance(x, Node.Node):
  				a = x
  			if isinstance(y, str):
  				b = self.path.find_or_declare(y)
  			elif isinstance(y, Node.Node):
  				b = y
  
  		if not a:
  			raise Errors.WafError('cound not find %r for %r' % (x, self))
  
  		has_constraints = False
  		tsk = self.create_task('subst', a, b)
  		for k in ('after', 'before', 'ext_in', 'ext_out'):
  			val = getattr(self, k, None)
  			if val:
  				has_constraints = True
  				setattr(tsk, k, val)
  
  		# paranoid safety measure for the general case foo.in->foo.h with ambiguous dependencies
  		if not has_constraints and b.name.endswith('.h'):
  			tsk.before = [k for k in ('c', 'cxx') if k in Task.classes]
  
  		inst_to = getattr(self, 'install_path', None)
  		if inst_to:
  			self.bld.install_files(inst_to, b, chmod=getattr(self, 'chmod', Utils.O644))
  
  	self.source = []
function_tokens: def process_subst ( self ) : src = Utils . to_list ( getattr ( self , 'source' , [ ] ) ) if isinstance ( src , Node . Node ) : src = [ src ] tgt = Utils . to_list ( getattr ( self , 'target' , [ ] ) ) if isinstance ( tgt , Node . Node ) : tgt = [ tgt ] if len ( src ) != len ( tgt ) : raise Errors . WafError ( 'invalid number of source/target for %r' % self ) for x , y in zip ( src , tgt ) : if not x or not y : raise Errors . WafError ( 'null source or target for %r' % self ) a , b = None , None if isinstance ( x , str ) and isinstance ( y , str ) and x == y : a = self . path . find_node ( x ) b = self . path . get_bld ( ) . make_node ( y ) if not os . path . isfile ( b . abspath ( ) ) : b . sig = None b . parent . mkdir ( ) else : if isinstance ( x , str ) : a = self . path . find_resource ( x ) elif isinstance ( x , Node . Node ) : a = x if isinstance ( y , str ) : b = self . path . find_or_declare ( y ) elif isinstance ( y , Node . Node ) : b = y if not a : raise Errors . WafError ( 'cound not find %r for %r' % ( x , self ) ) has_constraints = False tsk = self . create_task ( 'subst' , a , b ) for k in ( 'after' , 'before' , 'ext_in' , 'ext_out' ) : val = getattr ( self , k , None ) if val : has_constraints = True setattr ( tsk , k , val ) # paranoid safety measure for the general case foo.in->foo.h with ambiguous dependencies if not has_constraints and b . name . endswith ( '.h' ) : tsk . before = [ k for k in ( 'c' , 'cxx' ) if k in Task . classes ] inst_to = getattr ( self , 'install_path' , None ) if inst_to : self . bld . install_files ( inst_to , b , chmod = getattr ( self , 'chmod' , Utils . O644 ) ) self . source = [ ]