def __init__(self, builder=None, clArgs=None, configureParent=None): import RDict import project import sys if clArgs is None: clArgs = sys.argv[1:] self.logName = 'build.log' script.Script.__init__(self, clArgs, RDict.RDict()) if builder is None: import sourceDatabase import config.framework self.framework = config.framework.Framework( self.clArgs + ['-noOutput'], self.argDB) self.framework.setConfigureParent(configureParent) self.framework.logName = self.logName self.builder = __import__('builder').Builder( self.framework, sourceDatabase.SourceDB(self.root)) else: self.builder = builder self.framework = builder.framework self.framework.logName = self.logName self.configureMod = None self.builder.pushLanguage('C') return
def makeSourceDBPathsAbsolute(self, sourceDB): '''Return another source database in which all paths are absolute''' newDB = sourceDatabase.SourceDB(self.argDB) pwd = self.project.getRoot() for key in sourceDB: new_key = pwd+key newDB[new_key] = sourceDB[key] return newDB
def makeSourceDBPathsRelative(self, sourceDB): '''Return another source database in which all paths are relative to the root of this project''' import re newDB = sourceDatabase.SourceDB(self.argDB) pwd = self.project.getRoot() for key in sourceDB: new_key = re.split(pwd, key)[-1] newDB[new_key] = sourceDB[key] return newDB
def setupSourceDB(self, proj): '''Load any existing source database for the given project, and register its save method''' import project root = project.ProjectPath('', proj.getUrl()) filename = project.ProjectPath('bsSource.db', proj.getUrl()) self.debugPrint('Reading source database for '+proj.getUrl()+' from '+str(filename), 2, 'sourceDB') if os.path.exists(str(filename)): try: dbFile = open(str(filename), 'r') self.sourceDB = cPickle.load(dbFile) self.sourceDB.filename = filename dbFile.close() except Exception, e: self.debugPrint('Source database '+str(filename)+' could not be read: '+str(e)+'. Creating a new one', 2, 'sourceDB') self.sourceDB = sourceDatabase.SourceDB(root, filename)
def __init__(self, framework, sourceDB=None): import sourceControl import sourceDatabase logger.Logger.__init__(self, argDB=framework.argDB) self.framework = framework self.language = [] self.configurations = {} self.configurationName = [] if sourceDB is None: self.sourceDB = sourceDatabase.SourceDB(self.root) else: self.sourceDB = sourceDB self.shouldCompile = MD5DependencyChecker(self.sourceDB, argDB=self.argDB) self.shouldLink = TimeDependencyChecker(self.sourceDB, argDB=self.argDB) self.versionControl = sourceControl.BitKeeper(argDB=self.argDB) self.sourceDB.load() self.pushConfiguration('default') return
root = project.ProjectPath('', proj.getUrl()) filename = project.ProjectPath('bsSource.db', proj.getUrl()) self.debugPrint('Reading source database for '+proj.getUrl()+' from '+str(filename), 2, 'sourceDB') if os.path.exists(str(filename)): try: dbFile = open(str(filename), 'r') self.sourceDB = cPickle.load(dbFile) self.sourceDB.filename = filename dbFile.close() except Exception, e: self.debugPrint('Source database '+str(filename)+' could not be read: '+str(e)+'. Creating a new one', 2, 'sourceDB') self.sourceDB = sourceDatabase.SourceDB(root, filename) else: self.debugPrint('Source database '+str(filename)+' does not exist. Creating a new one', 2, 'sourceDB') self.sourceDB = sourceDatabase.SourceDB(root, filename) return def makeSourceDBPathsAbsolute(self, sourceDB): '''Return another source database in which all paths are absolute''' newDB = sourceDatabase.SourceDB(self.argDB) pwd = self.project.getRoot() for key in sourceDB: new_key = pwd+key newDB[new_key] = sourceDB[key] return newDB def makeSourceDBPathsRelative(self, sourceDB): '''Return another source database in which all paths are relative to the root of this project''' import re