summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-02-27 22:42:01 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2019-02-27 22:42:01 (GMT)
commit043f3fe3c182730eca17d68030f1de34fa88477e (patch)
tree9048f4319e9565721c5e65fa508f9a98892d1baf /src
parente863e1bc71aea05c554e6d06014b51c19f5a6bf5 (diff)
downloadSCons-043f3fe3c182730eca17d68030f1de34fa88477e.zip
SCons-043f3fe3c182730eca17d68030f1de34fa88477e.tar.gz
SCons-043f3fe3c182730eca17d68030f1de34fa88477e.tar.bz2
Fix Issue #3303 --config=force overwritting passed in Environment's Decider and not cleaning it up when configure context is complete
Diffstat (limited to 'src')
-rwxr-xr-xsrc/CHANGES.txt2
-rw-r--r--src/engine/SCons/Environment.py1
-rw-r--r--src/engine/SCons/SConf.py81
3 files changed, 61 insertions, 23 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 4acfcba..8fccdeb 100755
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -14,6 +14,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
The Configure logic directly calls the decider when using --config=force but wasn't handling
that exception. This would yield minimally configure tests using TryLink() not running and
leaving TypeError Nonetype exception in config.log
+ - Fix Issue #3303 - Handle --config=force overwriting the Environment passed into Configure()'s
+ Decider and not clearing it when the configure context is completed.
From Daniel Moody:
- Change the default for AppendENVPath to delete_existing=0, so path
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: