00001 __copyright__ = """
00002 Copyright 2008 Sean Ross-Ross
00003 """
00004 __license__ = """
00005 This file is part of SLIMpy .
00006
00007 SLIMpy is free software: you can redistribute it and/or modify
00008 it under the terms of the GNU Lesser General Public License as published by
00009 the Free Software Foundation, either version 3 of the License, or
00010 (at your option) any later version.
00011
00012 SLIMpy is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015 GNU Lesser General Public License for more details.
00016
00017 You should have received a copy of the GNU Lesser General Public License
00018 along with SLIMpy . If not, see <http://www.gnu.org/licenses/>.
00019 """
00020
00021 from slimpy_base.Core.Runners.dottestRunner import dottestRunner
00022 from SCons.Script import Builder,Action,ARGUMENTS
00023 from slimproj_core.builders.BuilderFunctions import DEFAULT_PROFILES
00024
00025 class DotTester( object ):
00026
00027 def __init__(self,name):
00028 self.name = name
00029 self.act = None
00030 self._built = False
00031
00032 def __str__(self):
00033 return "DotTester( )" %self.name
00034
00035 def set_action(self, act):
00036
00037 self.act = act
00038
00039 def set_env(self,target,source,env):
00040
00041 self.target = target[:]
00042 self.source = source[:]
00043 self.env = env.Clone()
00044
00045
00046 def dot_test(self):
00047
00048
00049 if self._built:
00050
00051 return
00052 action = Action( self.build, "Dottest '%s' " %( self.act.__name__) )
00053 builder = Builder( action=action,
00054 emitter=self.emitter
00055 )
00056
00057
00058 builder( self.env , self.name )
00059
00060 self._built = True
00061
00062 def emitter(self,target,source,env):
00063
00064 DEFAULT_PROFILES.append( target[0] )
00065
00066 source = self.source
00067
00068 env.Alias( 'dot-test', target )
00069 return target,source
00070
00071 def build(self,target,source,env):
00072
00073
00074
00075 env['verbose'] = ARGUMENTS.get('verbose',0)
00076
00077 debug = ARGUMENTS.get('debug',None)
00078 if debug:
00079 debug = debug.split(',')
00080 else:
00081 debug = []
00082 env['debug'] = debug
00083 env['logfile'] = None
00084
00085 runner = dottestRunner()
00086
00087 from slimpy_base.Environment.InstanceManager import InstanceManager
00088 __env__ = InstanceManager( )
00089 __env__['graphmgr'].setRunner( runner )
00090
00091 self.act( target, source, env )
00092
00093