def allFiles( self ): return itertools.chain( self.walkDirectory( os.path.join( ViDE.rootDirectory(), "lib" ) ), self.walkDirectory( os.path.join( ViDE.rootDirectory(), "BuildKits" ) ), self.walkDirectory( os.path.join( ViDE.rootDirectory(), "TestProjects" ) ), self.walkDirectory( os.path.join( ViDE.rootDirectory(), "ToolSets", "Tools" ) ), )
def setUp( self ): os.chdir( os.path.join( ViDE.rootDirectory(), "TestProjects", project ) ) self.__shell = Shell() self.__shell.execute( [ "test", "--silent", "--buildkit", bkName, "make" ] ) self.__targets = set() for source in whatIfs: for target in whatIfs[ source ]: self.__targets.add( target )
def __init__( self, context, url ): self.__url = url self.__file = os.path.join( ViDE.toolsCacheDirectory(), os.path.basename( urlparse.urlparse( url ).path ) ) AtomicArtifact.__init__( self, context = context, name = self.__file, files = [ self.__file ], strongDependencies = [], orderOnlyDependencies = [], automaticDependencies = [], explicit = False )
def test( self ): os.chdir( os.path.join( ViDE.rootDirectory(), "TestProjects", "CompilationError" ) ) shutil.rmtree( "build", True ) shell = Shell() shell.execute( [ "test", "--silent", "--buildkit", bkName, "make", "-k" ] ) time.sleep( 0.5 ) self.assertFalse( os.path.exists( cppObjFile( "a" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "b" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "c" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "d" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "e" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "main" ) ) ) self.assertFalse( os.path.exists( exeFile( "hello" ) ) )
def TestMake( project, whatIfs ): shutil.rmtree( os.path.join( ViDE.rootDirectory(), "TestProjects", project, "build" ), True ) class TestCase( unittest.TestCase ): # def __init__( self ): # unittest.TestCase.__init__( self ) def setUp( self ): os.chdir( os.path.join( ViDE.rootDirectory(), "TestProjects", project ) ) self.__shell = Shell() self.__shell.execute( [ "test", "--silent", "--buildkit", bkName, "make" ] ) self.__targets = set() for source in whatIfs: for target in whatIfs[ source ]: self.__targets.add( target ) def testMake( self ): for target in self.__targets: self.assertTrue( os.path.exists( target ), project + " " + target ) def testWhatIf( self ): for source in whatIfs: before = dict() for target in self.__targets: before[ target ] = os.stat( target ).st_mtime self.__shell.execute( [ "test", "--buildkit", bkName, "make", "--touch", "--new-file", source ] ) after = dict() for target in self.__targets: after[ target ] = os.stat( target ).st_mtime updatedTargets = set() for target in self.__targets: if after[ target ] != before[ target ]: updatedTargets.add( target ) self.assertEquals( updatedTargets, set( whatIfs[source] ), project + " " + source + " " + str( updatedTargets ) + " != " + str( whatIfs[source] ) ) return TestCase
def canBeDefault( self ): return ViDE.host() == "linux"
def getLibName(self): return self.getBoostLibName("python") + ("-py27" if ViDE.host() == "linux" else "")
import sys import ViDE from ViDE.Project.Project import Project from ViDE.Project.Description.Utilities import * from ViDE.Project.Description.CPlusPlus import __CppObjects, __CppSources from ViDE.Project.Artifacts import Python sys.path.append( ViDE.toolsetsDirectory() ) import Tools sys.path.pop() def __PythonSource( source, explicit = False ): if isArtifact( source ): return source else: return Project.inProgress.createArtifact( Python.Source, source, explicit ) def __PythonSources( sources ): return [ __PythonSource( source ) for source in sources ] def __PythonModule( source, strip, explicit = False ): return Project.inProgress.createArtifact( Python.Module, __PythonSource( source ), strip, explicit ) def __PythonModules( sources, modules, strip ): return modules + [ __PythonModule( source, strip ) for source in sources ] def PythonSource( source ): return __PythonSource( source, True ) def PythonModule( source, strip = identity ):
def getLibName( self ): if ViDE.host() == "win32": return "python27" else: return Python.versionName
def getLibPath( self ): if ViDE.host() == "win32": return "c:\\Python27\\libs" else: return None
def canBeDefault( self ): return ViDE.host() == "win32"
def canBeDefault( self ): return ViDE.host() == "cygwin"
def __computeLoadDirectory( cls ): return os.path.join( ViDE.rootDirectory(), "Loadables", cls.__name__ + "s" )