1import config.base 2import os 3import re 4 5class Configure(config.base.Configure): 6 def __init__(self, framework): 7 config.base.Configure.__init__(self, framework) 8 return 9 10 def setupDependencies(self, framework): 11 self.installdir = framework.require('PETSc.options.installDir',self) 12 self.arch = framework.require('PETSc.options.arch',self) 13 return 14 15 def setExternalPackagesDir(self): 16 if self.framework.externalPackagesDir is None: 17 self.dir = os.path.join(os.path.abspath(os.path.join(self.arch.arch)), 'externalpackages') 18 else: 19 self.dir = os.path.join(self.framework.externalPackagesDir,self.arch.arch) 20 return 21 22 def cleanExternalpackagesDir(self): 23 import shutil 24 if self.framework.argDB['with-clean'] and os.path.isdir(self.dir): 25 self.logPrintBox('Warning: "with-clean" is specified. Removing all externalpackage files from '+ self.dir) 26 shutil.rmtree(self.dir) 27 return 28 29 def configure(self): 30 self.executeTest(self.setExternalPackagesDir) 31 self.executeTest(self.cleanExternalpackagesDir) 32 33 return 34