def declare_chain(name='', action='', ext_in='', ext_out='', reentrant=True, color='BLUE',
	install=0, before=[], after=[], decider=None, rule=None, scan=None):
	"""
	see Tools/flex.py for an example
	while i do not like such wrappers, some people really do
	"""

	action = action or rule
	if isinstance(action, str):
		act = Task.simple_task_type(name, action, color=color)
	else:
		act = Task.task_type_from_func(name, action, color=color)
	act.ext_in = tuple(Utils.to_list(ext_in))
	act.ext_out = tuple(Utils.to_list(ext_out))
	act.before = Utils.to_list(before)
	act.after = Utils.to_list(after)
	act.scan = scan

	def x_file(self, node):
		if decider:
			ext = decider(self, node)
		else:
			ext = ext_out

		if isinstance(ext, str):
			out_source = node.change_ext(ext)
			if reentrant:
				self.allnodes.append(out_source)
		elif isinstance(ext, list):
			out_source = [node.change_ext(x) for x in ext]
			if reentrant:
				for i in xrange((reentrant is True) and len(out_source) or reentrant):
					self.allnodes.append(out_source[i])
		else:
			# XXX: useless: it will fail on Utils.to_list above...
			raise Utils.WafError(str(ext) % "do not know how to process %s")

		tsk = self.create_task(name, node, out_source)

		if node.__class__.bld.is_install:
			tsk.install = install

	declare_extension(act.ext_in, x_file)
dataset/ETHPy150Open appcelerator-archive/poc-nodejs-desktop/Resources/nodejs/builds/linux/node/lib/node/wafadmin/TaskGen.py/declare_chain/swapped operands of `%`