def t_configure(self): '''Runs configure.py if it is present, and either configure.log is missing or -forceConfigure is given''' if self.argDB['noConfigure']: return import config.framework root = self.project.getRoot() framework = config.framework.Framework(sys.argv[1:]) for arg in ['debugLevel', 'debugSections']: framework.argDB[arg] = self.argDB[arg] framework.argDB['log'] = os.path.join(root, 'configure.log') if not self.configureHeader is None: framework.header = self.configureHeader # Load default configure module try: framework.addChild(self.getMakeModule(root, 'configure').Configure(framework)) except ImportError: return # Run configuration only if the log file was absent or it is forced if self.argDB['forceConfigure'] or not framework.checkLog(framework.logName): try: framework.configure() except Exception, e: import traceback msg = 'CONFIGURATION FAILURE:\n'+str(e)+'\n' print msg framework.log.write(msg) traceback.print_tb(sys.exc_info()[2], file = framework.log) raise e framework.storeSubstitutions(self.argDB)
def setupConfigure(self, framework): framework.header = os.path.join('include', 'config.h') framework.cHeader = os.path.join('include', 'configC.h') try: if self.configureMod is None: self.configureMod = self.getModule(self.root, 'configure') self.configureObj = self.configureMod.Configure(framework) self.logPrint('Configure module found in '+self.configureObj.root) self.configureObj.argDB = self.argDB self.configureObj.setup() self.configureObj.setupPackageDependencies(framework) self.configureObj.setupDependencies(framework) framework.addChild(self.configureObj) except ImportError, e: self.configureObj = None self.logPrint('Configure module not present: '+str(e)) return 0
def setupConfigure(self, framework): framework.header = os.path.join('include', 'config.h') framework.cHeader = os.path.join('include', 'configC.h') try: if self.configureMod is None: self.configureMod = self.getModule(self.root, 'configure') self.configureObj = self.configureMod.Configure(framework) self.logPrint('Configure module found in ' + self.configureObj.root) self.configureObj.argDB = self.argDB self.configureObj.setup() self.configureObj.setupPackageDependencies(framework) self.configureObj.setupDependencies(framework) framework.addChild(self.configureObj) except ImportError, e: self.configureObj = None self.logPrint('Configure module not present: ' + str(e)) return 0
def setOutput(self): '''Add defines and substitutions - HAVE_PETSC is defined if a working PETSc is found - PETSC_INCLUDE and PETSC_LIB are command line arguments for the compile and link''' if self.found: self.addDefine('HAVE_PETSC', 1) self.addSubstitution( 'PETSC_INCLUDE', ' '.join([ self.headers.getIncludeArgument(inc) for inc in self.include ])) self.addSubstitution( 'PETSC_LIB', ' '.join(map(self.libraries.getLibArgument, self.lib))) return def configure(self): self.executeTest(self.configureLibrary) self.setOutput() return if __name__ == '__main__': import config.framework import sys framework = config.framework.Framework(sys.argv[1:]) framework.setup() framework.addChild(Configure(framework)) framework.configure() framework.dumpSubstitutions()
break if found: self.logPrint('Choose PETSc '+self.version+' in '+self.name) else: raise RuntimeError('Could not locate any functional PETSc') return def setOutput(self): '''Add defines and substitutions - HAVE_PETSC is defined if a working PETSc is found - PETSC_INCLUDE and PETSC_LIB are command line arguments for the compile and link''' if self.found: self.addDefine('HAVE_PETSC', 1) self.addSubstitution('PETSC_INCLUDE', ' '.join([self.headers.getIncludeArgument(inc) for inc in self.include])) self.addSubstitution('PETSC_LIB', ' '.join(map(self.libraries.getLibArgument, self.lib))) return def configure(self): self.executeTest(self.configureLibrary) self.setOutput() return if __name__ == '__main__': import config.framework import sys framework = config.framework.Framework(sys.argv[1:]) framework.setup() framework.addChild(Configure(framework)) framework.configure() framework.dumpSubstitutions()