Example #1
0
  def __init__(self, buildPath, options, args):
    self.buildPath = buildPath
    self.options = options
    self.args = args
    self.cacheFolder = os.path.join(buildPath, '.ambuild2')
    self.dbpath = os.path.join(self.cacheFolder, 'graph')

    # This doesn't completely work yet because it's not communicated to child
    # processes. We'll have to send a message down or up to fix this.
    if self.options.no_color:
      util.DisableConsoleColors()

    with open(os.path.join(self.cacheFolder, 'vars'), 'rb') as fp:
      try:
        self.vars = util.pickle.load(fp)
      except ValueError as exn:
        sys.stderr.write('Build was configured with Python 3; use python3 instead.\n')
        sys.exit(1)
      except Exception as exn:
        if os.path.exists(os.path.join(self.cacheFolder, 'vars')):
          sys.stderr.write('There does not appear to be a build configured here.\n')
        else:
          sys.stderr.write('The build configured here looks corrupt; you will have to delete your objdir.\n')
        raise
        sys.exit(1)

    self.restore_environment()

    self.db = database.Database(self.dbpath)
    self.messagePump = MessagePump()
    self.procman = ProcessManager(self.messagePump)
    self.db.connect()
Example #2
0
  def preGenerate(self):
    if not os.path.isdir(self.cacheFolder):
      os.mkdir(self.cacheFolder)
    if not self.db:
      db_path = os.path.join(self.cacheFolder, 'graph')
      if not os.path.isfile(db_path):
        self.db = database.CreateDatabase(db_path)
      else:
        self.db = database.Database(db_path)
        self.db.connect()

    self.symlink_support = util.DetectSymlinkSupport()

    self.db.query_scripts(lambda id,path,stamp: self.old_scripts_.add(path))
    self.db.query_mkdir(lambda entry: self.old_folders_.add(entry))
    self.db.query_commands(lambda entry: self.old_commands_.add(entry))
    self.db.set_var('api_version', '2.1')