summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-02-28 21:37:59 (GMT)
committerGitHub <noreply@github.com>2019-02-28 21:37:59 (GMT)
commit1292c3f8c0a652c301ca5407de59b85b54011cfb (patch)
treed5e4e55475d23b27d05531a6565bcae996fd2cb4 /src/engine
parent7a32722522e2f76df8886721db3648b69cec4ce1 (diff)
parent2ea6b7a551620c56f61a5dd9a9c94e342993795e (diff)
downloadSCons-1292c3f8c0a652c301ca5407de59b85b54011cfb.zip
SCons-1292c3f8c0a652c301ca5407de59b85b54011cfb.tar.gz
SCons-1292c3f8c0a652c301ca5407de59b85b54011cfb.tar.bz2
Merge pull request #3313 from bdbaddog/fix_gh_3303_force_config_alters_env_decider
Fix issue #3303 - --config=force overwriting environment passed to Configure()
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Environment.py1
-rw-r--r--src/engine/SCons/SConf.py81
-rw-r--r--src/engine/SCons/SConfTests.py2
3 files changed, 60 insertions, 24 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 152f0bc..eea8aed 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -2372,6 +2372,7 @@ class OverrideEnvironment(Base):
kw = copy_non_reserved_keywords(kw)
self.__dict__['overrides'].update(semi_deepcopy(kw))
+
# The entry point that will be used by the external world
# to refer to a construction environment. This allows the wrapper
# interface to extend a construction environment for its own purposes
diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py
index f23c401..b123c11 100644
--- a/src/engine/SCons/SConf.py
+++ b/src/engine/SCons/SConf.py
@@ -324,24 +324,6 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask):
s = sys.stdout = sys.stderr = Streamer(sys.stdout)
try:
env = self.targets[0].get_build_env()
- if cache_mode == FORCE:
- # Set up the Decider() to force rebuilds by saying
- # that every source has changed. Note that we still
- # call the environment's underlying source decider so
- # that the correct .sconsign info will get calculated
- # and keep the build state consistent.
- def force_build(dependency, target, prev_ni,
- env_decider=env.decide_source,
- node=None):
- try:
- env_decider(dependency, target, prev_ni)
- except DeciderNeedsNode as e:
- e.decider(target, prev_ni, node=target)
- except Exception as e:
- raise e
- return True
- if env.decide_source.__code__ is not force_build.__code__:
- env.Decider(force_build)
env['PSTDOUT'] = env['PSTDERR'] = s
try:
sconf.cached = 0
@@ -412,12 +394,42 @@ class SConfBase(object):
build tests in the VariantDir, not in the SourceDir)
"""
global SConfFS
+
+ # Now create isolated override so setting source_decider doesn't affect parent Environment
+ if cache_mode == FORCE:
+ self.original_env = env
+ self.env = env.Clone()
+
+ # Set up the Decider() to force rebuilds by saying
+ # that every source has changed. Note that we still
+ # call the environment's underlying source decider so
+ # that the correct .sconsign info will get calculated
+ # and keep the build state consistent.
+ def force_build(dependency, target, prev_ni,
+ env_decider=env.decide_source,
+ node=None):
+ try:
+ env_decider(dependency, target, prev_ni)
+ except DeciderNeedsNode as e:
+ e.decider(target, prev_ni, node=target)
+ except Exception as e:
+ raise e
+ return True
+
+ if self.env.decide_source.__code__ is not force_build.__code__:
+ self.env.Decider(force_build)
+
+ else:
+ self.env = env
+
+ # print("Override env:%s"%env)
+
if not SConfFS:
SConfFS = SCons.Node.FS.default_fs or \
SCons.Node.FS.FS(env.fs.pathTop)
if sconf_global is not None:
raise SCons.Errors.UserError
- self.env = env
+
if log_file is not None:
log_file = SConfFS.File(env.subst(log_file))
self.logfile = log_file
@@ -456,6 +468,7 @@ class SConfBase(object):
env = sconf.Finish()
"""
self._shutdown()
+
return self.env
def Define(self, name, value = None, comment = None):
@@ -510,6 +523,20 @@ class SConfBase(object):
n.attributes = SCons.Node.Node.Attrs()
n.attributes.keep_targetinfo = 1
+ if True:
+ # Some checkers have intermediate files (for example anything that compiles a c file into a program to run
+ # Those files need to be set to not release their target info, otherwise taskmaster will throw a
+ # Nonetype not callable
+ for c in n.children(scan=False):
+ # Keep debug code here.
+ # print("Checking [%s] for builders and then setting keep_targetinfo"%c)
+ if c.has_builder():
+ n.store_info = 0
+ if not hasattr(c, 'attributes'):
+ c.attributes = SCons.Node.Node.Attrs()
+ c.attributes.keep_targetinfo = 1
+ # pass
+
ret = 1
try:
@@ -746,10 +773,18 @@ class SConfBase(object):
self.logstream.write("\n")
self.logstream.close()
self.logstream = None
- # remove the SConfSourceBuilder from the environment
- blds = self.env['BUILDERS']
- del blds['SConfSourceBuilder']
- self.env.Replace( BUILDERS=blds )
+
+ # Now reset the decider if we changed it due to --config=force
+ # We saved original Environment passed in and cloned it to isolate
+ # it from being changed.
+ if cache_mode == FORCE:
+ self.env.Decider(self.original_env.decide_source)
+
+ # remove the SConfSourceBuilder from the environment
+ blds = self.env['BUILDERS']
+ del blds['SConfSourceBuilder']
+ self.env.Replace( BUILDERS=blds )
+
self.active = 0
sconf_global = None
if not self.config_h is None:
diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py
index 73fcf8d..f770450 100644
--- a/src/engine/SCons/SConfTests.py
+++ b/src/engine/SCons/SConfTests.py
@@ -194,7 +194,7 @@ class SConfTestCase(unittest.TestCase):
pass
def add_post_action(self, *actions):
pass
- def children(self):
+ def children(self, scan = 1):
return []
def get_state(self):
return self.state