Example #1
0
 def findAllCodeModulePaths( self, searchPaths ):
     from ctx_cmod import isContexoCodeModule, CTXRawCodeModule
 
     searchPaths = assureList ( searchPaths )
 
     pathList = list ()
     for path in searchPaths:
         codeModulePaths = []
 
         if len(codeModulePaths) == 0:
             try:
                 pathCandidates = os.listdir( path )
             except OSError, (errno,  errmsg):
                 userErrorExit("Could not list directory '%s': %s"%(path,  errmsg))
             for cand in pathCandidates:
                 candPath = os.path.join( path, cand )
                 if isContexoCodeModule( candPath ) == True:
                     emptyPathList = list()
                     unitTestDummyValue = False
                     mod = CTXRawCodeModule(candPath, emptyPathList, unitTestDummyValue, self.archPath, self.legacyCompilingMod, self.globalOutputDir,bc = self.bc)
                     codeModulePaths.append( mod.getPubHeaderDir() )
                     codeModulePaths.append( mod.getPrivHeaderDir() )
                     codeModulePaths.append( mod.getSourceDir () )
                     codeModulePaths.append( mod.getTestDir () )
         pathList.extend( codeModulePaths )
Example #2
0
    def getDependentModules( self, module ):
        from ctx_cmod import CTXRawCodeModule, isContexoCodeModule

        modules = list ()

        if not self.cmods.has_key(module):

            emptyPathList = list()
            unitTestsDummyValue = False
            cmod = CTXRawCodeModule( moduleRoot = module, pathlist = emptyPathList, buildUnitTests = unitTestsDummyValue, archPath = self.archPath, legacyCompilingMod = self.legacyCompilingMod, outputDir = self.globalOutputDir, bc = self.bc )
            self.updateModuleDependencies( cmod )

        modulePubFiles = set(self.cmods[module].getPubHeaderFilenames())

        candidates = self.findAllCodeModules( self.codeModulePaths )
        for candidate in candidates:
            if not self.moduleDependencies.has_key( candidate[0] ):
                if isContexoCodeModule( candidate[1] ):
                    cmod = CTXRawCodeModule( candidate[1] )
                    self.updateModuleDependencies( cmod )

            dependentFiles = self.moduleDependencies[candidate[0]]
            if not modulePubFiles.isdisjoint (dependentFiles):
                modules.append( candidate[0] )

        return modules
Example #3
0
    def resolveCodeModulePath(self, mod):
        import ctx_cmod

        modPath = mod

        # if not os.path.exists( modPath ):
        for path in self.depRoots:
            modPath = os.path.join(path, mod)
            if os.path.exists(modPath):
                if ctx_cmod.isContexoCodeModule(modPath):
                    break
                else:
                    infoMessage(
                        "Ignoring directory %s since it is not a valid contexo module: no folder named 'contexo', 'doc', 'src', 'test', 'inc' nor header files found."
                        % modPath,
                        3,
                    )
            else:
                modPath = str()

        if len(modPath) == 0:
            userErrorExit("Unable to locate code module: '%s'" % mod)

        ctx_cmod.assertValidContexoCodeModule(modPath, self.msgSender)

        return modPath
Example #4
0
    def findAllCodeModules(self, searchPaths ):
        from ctx_cmod import isContexoCodeModule, CTXRawCodeModule

        searchPaths = assureList ( searchPaths )

        modules = list ()
        for path in searchPaths:
            pathCandidates = os.listdir( path )
            for candidate in pathCandidates:
                candPath = os.path.join( path, candidate )
                if isContexoCodeModule( candPath ) == True:
                    modules.append( (candidate, candPath) )

        return modules
Example #5
0
 def getModuleDependencies( self, modules ):
     import ctx_cmod
     dependencies = set()
     if self.needUpdate:
         self.updateDependencyHash()
     for module in modules:
         if module in self.moduleDependencies:
             deps = self.moduleDependencies[module]
             for dep in deps:
                 depPath = self.locate(dep)
                 if depPath != None:
                     depMod = os.path.dirname(depPath)
                     if os.path.basename(depMod) in ctx_cmod.criteriaDirs:
                         depMod = os.path.dirname(depMod)
                     if ctx_cmod.isContexoCodeModule( depMod ):
                         print >>sys.stderr, depMod
                         modName = os.path.basename( depMod )
                         dependencies.add( modName )
     return dependencies
Example #6
0
    def getCodeModulesWithDependencies( self ):
        import ctx_cmod

        if self.needUpdate:
            self.updateDependencyHash()

        processed_set = set ()
        moduleRoots = set ( map(lambda mod: mod.modRoot,  self.cmods.values() ))

        while moduleRoots != processed_set:
            for moduleRoot in moduleRoots - processed_set:
                incPathSet = self.getModuleIncludePaths(moduleRoot)

                for path in incPathSet:
                    if ctx_cmod.isContexoCodeModule ( path ): #WARNING: assuming public headers lie in the root of a module
                        moduleRoots.add (  path  )

                processed_set.add ( moduleRoot )

        return list (moduleRoots)
Example #7
0
    def resolveCodeModulePath( self, mod ):
        import ctx_cmod

        modPath = mod

        #if not os.path.exists( modPath ):
        for path in self.depRoots:
            modPath = os.path.join( path, mod )
            if os.path.exists( modPath ):
                if ctx_cmod.isContexoCodeModule(modPath):
                    break
                else:
                    infoMessage( "Directory %s is not a valid contexo module, ignoring"%modPath,  3  )
            else:
                modPath = str()

        if len(modPath) == 0:
            userErrorExit("Unable to locate code module: '%s'"%mod)

        ctx_cmod.assertValidContexoCodeModule( modPath, self.msgSender )

        return modPath
Example #8
0
    def getDependentModules( self, module ):
        from ctx_cmod import CTXRawCodeModule, isContexoCodeModule

        modules = list ()

        if not self.cmods.has_key(module):
            cmod = CTXRawCodeModule( module )
            self.updateModuleDependencies( cmod )

        modulePubFiles = set(self.cmods[module].getPubHeaderFilenames())

        candidates = finAllCodeModules( self.codeModulePaths )
        for candidate in candidates:
            if not self.moduleDependencies.has_key( candidate[0] ):
                if isContexoCodeModule( candidate[1] ):
                    cmod = CTXRawCodeModule( candidate[1] )
                    self.updateModuleDependencies( cmod )

            dependentFiles = self.moduleDependencies[candidate[0]]
            if not modulePubFiles.isdisjoint (dependentFiles):
                modules.append( candidate[0] )

        return modules
Example #9
0
def findAllCodeModulPaths( searchPaths ):
    from ctx_cmod import isContexoCodeModule, CTXRawCodeModule

    searchPaths = assureList ( searchPaths )

    pathList = list ()
    for path in searchPaths:
        codeModulePaths = []

        if len(codeModulePaths) == 0:
            try:
                pathCandidates = os.listdir( path )
            except OSError, (errno,  errmsg):
                userErrorExit("Could not list directory '%s': %s"%(path,  errmsg))
            for cand in pathCandidates:
                candPath = os.path.join( path, cand )
                if isContexoCodeModule( candPath ) == True:
                    mod = CTXRawCodeModule(candPath)
                    codeModulePaths.append( mod.getPubHeaderDir() )
                    codeModulePaths.append( mod.getPrivHeaderDir() )
                    codeModulePaths.append( mod.getSourceDir () )
                    codeModulePaths.append( mod.getTestDir () )
        pathList.extend( codeModulePaths )
Example #10
0
#
# We append all codemodule paths available in system config CONTEXO_DEPEND_PATHS
# as include paths, rather than trying to figure out exactly which ones we actually need.
# Build time may increase, but we avoid complex logic extracting dependencies from
# dependency manager.
#

modTags = list()
incPaths    = list()
syscfg      = getSystemConfig()
depRoots    = syscfg['CONTEXO_DEPEND_PATHS']
for depRoot in depRoots:
    incPathCandidates = os.listdir( depRoot )
    for cand in incPathCandidates:
        path = os.path.join(depRoot, cand)
        if ctx_cmod.isContexoCodeModule( path ):
            rawMod = CTXRawCodeModule(path)
            incPaths.append( path )
            # Only include private headers for projects containing the specified module
            #incPaths.append( os.path.join(rawMod.getRootPath(), rawMod.getPrivHeaderDir()) )
            modTags.append( 'COMPILING_MOD_' + string.upper( rawMod.getName() ) )

incPaths += additionalIncPaths


#
# Create all component objects and collect all modules names involved.
#

preloadModules = list()
components = list()