1.1 --- a/ambuild2/frontend/amb2/gen.py Sun Feb 02 14:00:01 2014 -0800
1.2 +++ b/ambuild2/frontend/amb2/gen.py Fri Feb 07 22:54:58 2014 -0800
1.3 @@ -27,8 +27,8 @@
1.4 self.debug = debug_outputs
1.5
1.6 class Generator(base_gen.Generator):
1.7 - def __init__(self, sourcePath, buildPath, options, args, db=None, refactoring=False):
1.8 - super(Generator, self).__init__(sourcePath, buildPath, options, args)
1.9 + def __init__(self, sourcePath, buildPath, originalCwd, options, args, db=None, refactoring=False):
1.10 + super(Generator, self).__init__(sourcePath, buildPath, originalCwd, options, args)
1.11 self.cacheFolder = os.path.join(self.buildPath, '.ambuild2')
1.12 self.old_scripts_ = set()
1.13 self.old_folders_ = set()
1.14 @@ -40,6 +40,28 @@
1.15 self.is_bootstrap = not self.db
1.16 self.refactoring = refactoring
1.17
1.18 + @classmethod
1.19 + def FromVars(cls, vars, db, refactoring):
1.20 + # Backwards compatibility: for an automatic reconfigure on an older build,
1.21 + # just assume the source path is the cwd. If the AMBuildScript suddenly
1.22 + # has decided to depend on originalCwd, then the user may have to manually
1.23 + # run configure.py again, until we remove configure.py entirely.
1.24 + if 'originalCwd' in vars:
1.25 + originalCwd = vars['originalCwd']
1.26 + else:
1.27 + originalCwd = vars['sourcePath']
1.28 +
1.29 + gen = cls(
1.30 + sourcePath = vars['sourcePath'],
1.31 + buildPath = vars['buildPath'],
1.32 + originalCwd = originalCwd,
1.33 + options = vars['options'],
1.34 + args = vars['args'],
1.35 + db = db,
1.36 + refactoring = refactoring
1.37 + )
1.38 + return gen
1.39 +
1.40 def preGenerate(self):
1.41 if not os.path.isdir(self.cacheFolder):
1.42 os.mkdir(self.cacheFolder)
1.43 @@ -137,6 +159,7 @@
1.44 vars = {
1.45 'sourcePath': self.sourcePath,
1.46 'buildPath': self.buildPath,
1.47 + 'originalCwd': self.originalCwd,
1.48 'options': self.options,
1.49 'args': self.args
1.50 }