# Path: waflib/TaskGen.py
# def feature(*k):
# 	"""
# 	Decorator that registers a task generator method that will be executed when the
# 	object attribute ``feature`` contains the corresponding key(s)::
# 
# 		from waflib.Task import feature
# 		@feature('myfeature')
# 		def myfunction(self):
# 			print('that is my feature!')
# 		def build(bld):
# 			bld(features='myfeature')
# 
# 	:param k: feature names
# 	:type k: list of string
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for name in k:
# 			feats[name].update([func.__name__])
# 		return func
# 	return deco
# 
# def after_method(*k):
# 	"""
# 	Decorator that registers a task generator method which will be executed
# 	after the functions of given name(s)::
# 
# 		from waflib.TaskGen import feature, after
# 		@feature('myfeature')
# 		@after_method('fun2')
# 		def fun1(self):
# 			print('feature 1!')
# 		@feature('myfeature')
# 		def fun2(self):
# 			print('feature 2!')
# 		def build(bld):
# 			bld(features='myfeature')
# 
# 	:param k: method names
# 	:type k: list of string
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for fun_name in k:
# 			task_gen.prec[fun_name].add(func.__name__)
# 		return func
# 	return deco
# 
# def taskgen_method(func):
# 	"""
# 	Decorator that registers method as a task generator method.
# 	The function must accept a task generator as first parameter::
# 
# 		from waflib.TaskGen import taskgen_method
# 		@taskgen_method
# 		def mymethod(self):
# 			pass
# 
# 	:param func: task generator method to add
# 	:type func: function
# 	:rtype: function
# 	"""
# 	setattr(task_gen, func.__name__, func)
# 	return func
# 
# Path: waflib/Tools/ccroot.py
# SYSTEM_LIB_PATHS = ['/usr/lib64', '/usr/lib', '/usr/local/lib64', '/usr/local/lib']
# USELIB_VARS = Utils.defaultdict(set)
# def create_compiled_task(self, name, node):
# def to_incnodes(self, inlst):
# def apply_incpaths(self):
# 	def add_target(self, target):
# 	def exec_command(self, *k, **kw):
# 	def exec_mf(self):
# def rm_tgt(cls):
# 	def wrap(self):
# def apply_skip_stlib_link_deps(self):
# def apply_link(self):
# def use_rec(self, name, **kw):
# def process_use(self):
# def accept_node_to_link(self, node):
# def add_objects_from_tgen(self, tg):
# def get_uselib_vars(self):
# def propagate_uselib_vars(self):
# def apply_implib(self):
# def apply_vnum(self):
# 	def keyword(self):
# 	def run(self):
# 	def runnable_status(self):
# 	def runnable_status(self):
# def read_shlib(self, name, paths=[], export_includes=[], export_defines=[]):
# def read_stlib(self, name, paths=[], export_includes=[], export_defines=[]):
# def process_lib(self):
# 	def runnable_status(self):
# def add_those_o_files(self, node):
# def process_objs(self):
# def read_object(self, obj):
# def set_full_paths_hpux(self):
# class link_task(Task.Task):
# class stlink_task(link_task):
# class vnum(Task.Task):
# class fake_shlib(link_task):
# class fake_stlib(stlink_task):
# class fake_o(Task.Task):


import os, shlex, sys
from waflib.TaskGen import feature, after_method, taskgen_method
from waflib import Utils, Task, Logs, Options
from waflib.Tools import ccroot
	"""Create interpreted unit tests."""
	for x in ['test_scripts_source', 'test_scripts_template']:
		if not hasattr(self, x):
			Logs.warn('a test_scripts taskgen i missing %s' % x)
			return

	self.ut_run, lst = Task.compile_fun(self.test_scripts_template, shell=getattr(self, 'test_scripts_shell', False))

	script_nodes = self.to_nodes(self.test_scripts_source)
	for script_node in script_nodes:
		tsk = self.create_task('utest', [script_node])
		tsk.vars = lst + tsk.vars
		tsk.env['SCRIPT'] = script_node.path_from(tsk.get_cwd())

	self.handle_ut_cwd('test_scripts_cwd')

	env = getattr(self, 'test_scripts_env', None)
	if env:
		self.ut_env = env
	else:
		self.ut_env = dict(os.environ)

	paths = getattr(self, 'test_scripts_paths', {})
	for (k,v) in paths.items():
		p = self.ut_env.get(k, '').split(os.pathsep)
		if isinstance(v, str):
			v = v.split(os.pathsep)
		self.ut_env[k] = os.pathsep.join(p + v)

@feature('test')

# Path: waflib/TaskGen.py
# def feature(*k):
# 	"""
# 	Decorator that registers a task generator method that will be executed when the
# 	object attribute ``feature`` contains the corresponding key(s)::
# 
# 		from waflib.Task import feature
# 		@feature('myfeature')
# 		def myfunction(self):
# 			print('that is my feature!')
# 		def build(bld):
# 			bld(features='myfeature')
# 
# 	:param k: feature names
# 	:type k: list of string
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for name in k:
# 			feats[name].update([func.__name__])
# 		return func
# 	return deco
# 
# def after_method(*k):
# 	"""
# 	Decorator that registers a task generator method which will be executed
# 	after the functions of given name(s)::
# 
# 		from waflib.TaskGen import feature, after
# 		@feature('myfeature')
# 		@after_method('fun2')
# 		def fun1(self):
# 			print('feature 1!')
# 		@feature('myfeature')
# 		def fun2(self):
# 			print('feature 2!')
# 		def build(bld):
# 			bld(features='myfeature')
# 
# 	:param k: method names
# 	:type k: list of string
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for fun_name in k:
# 			task_gen.prec[fun_name].add(func.__name__)
# 		return func
# 	return deco
# 
# def taskgen_method(func):
# 	"""
# 	Decorator that registers method as a task generator method.
# 	The function must accept a task generator as first parameter::
# 
# 		from waflib.TaskGen import taskgen_method
# 		@taskgen_method
# 		def mymethod(self):
# 			pass
# 
# 	:param func: task generator method to add
# 	:type func: function
# 	:rtype: function
# 	"""
# 	setattr(task_gen, func.__name__, func)
# 	return func
# 
# Path: waflib/Tools/ccroot.py
# SYSTEM_LIB_PATHS = ['/usr/lib64', '/usr/lib', '/usr/local/lib64', '/usr/local/lib']
# USELIB_VARS = Utils.defaultdict(set)
# def create_compiled_task(self, name, node):
# def to_incnodes(self, inlst):
# def apply_incpaths(self):
# 	def add_target(self, target):
# 	def exec_command(self, *k, **kw):
# 	def exec_mf(self):
# def rm_tgt(cls):
# 	def wrap(self):
# def apply_skip_stlib_link_deps(self):
# def apply_link(self):
# def use_rec(self, name, **kw):
# def process_use(self):
# def accept_node_to_link(self, node):
# def add_objects_from_tgen(self, tg):
# def get_uselib_vars(self):
# def propagate_uselib_vars(self):
# def apply_implib(self):
# def apply_vnum(self):
# 	def keyword(self):
# 	def run(self):
# 	def runnable_status(self):
# 	def runnable_status(self):
# def read_shlib(self, name, paths=[], export_includes=[], export_defines=[]):
# def read_stlib(self, name, paths=[], export_includes=[], export_defines=[]):
# def process_lib(self):
# 	def runnable_status(self):
# def add_those_o_files(self, node):
# def process_objs(self):
# def read_object(self, obj):
# def set_full_paths_hpux(self):
# class link_task(Task.Task):
# class stlink_task(link_task):
# class vnum(Task.Task):
# class fake_shlib(link_task):
# class fake_stlib(stlink_task):
# class fake_o(Task.Task):


# Path: waflib/Tools/waf_unit_test.py
import os, shlex, sys
from waflib.TaskGen import feature, after_method, taskgen_method
from waflib import Utils, Task, Logs, Options
from waflib.Tools import ccroot

	"""Create interpreted unit tests."""
	for x in ['test_scripts_source', 'test_scripts_template']:
		if not hasattr(self, x):
			Logs.warn('a test_scripts taskgen i missing %s' % x)
			return

	self.ut_run, lst = Task.compile_fun(self.test_scripts_template, shell=getattr(self, 'test_scripts_shell', False))

	script_nodes = self.to_nodes(self.test_scripts_source)
	for script_node in script_nodes:
		tsk = self.create_task('utest', [script_node])
		tsk.vars = lst + tsk.vars
		tsk.env['SCRIPT'] = script_node.path_from(tsk.get_cwd())

	self.handle_ut_cwd('test_scripts_cwd')

	env = getattr(self, 'test_scripts_env', None)
	if env:
		self.ut_env = env
	else:
		self.ut_env = dict(os.environ)

	paths = getattr(self, 'test_scripts_paths', {})
	for (k,v) in paths.items():
		p = self.ut_env.get(k, '').split(os.pathsep)
		if isinstance(v, str):
			v = v.split(os.pathsep)
		self.ut_env[k] = os.pathsep.join(p + v)

@feature('test')

@after_method('apply_link', 'process_use')