diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2019-07-14 08:41:28 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2019-07-14 08:41:28 +0200 |
commit | 544b5775c876175d33b7d14cd8efba615b8a50f7 (patch) | |
tree | 2fb503356682c0ad0fb941ac9154de15bc46157a /src/engine/SCons/SConf.py | |
parent | 85dbcc01ae3f6b10849aa71faef6946d8e16d55f (diff) | |
parent | 3023c58e287f26f5672cf5ddf991ba3197d1efb6 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/engine/SCons/SConf.py')
-rw-r--r-- | src/engine/SCons/SConf.py | 84 |
1 files changed, 63 insertions, 21 deletions
diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index c1ab159..e0cd35d 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -12,7 +12,7 @@ libraries are installed, if some command line options are supported etc. """ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -35,7 +35,7 @@ libraries are installed, if some command line options are supported etc. # from __future__ import print_function -__revision__ = "src/engine/SCons/SConf.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/SConf.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import SCons.compat @@ -56,6 +56,7 @@ import SCons.Warnings import SCons.Conftest from SCons.Debug import Trace +from SCons.Node import DeciderNeedsNode # Turn off the Conftest error logging SCons.Conftest.LogInputFiles = 0 @@ -323,18 +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): - env_decider(dependency, target, prev_ni) - 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 @@ -405,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 @@ -449,6 +468,7 @@ class SConfBase(object): env = sconf.Finish() """ self._shutdown() + return self.env def Define(self, name, value = None, comment = None): @@ -503,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: @@ -609,7 +643,7 @@ class SConfBase(object): ok = self.TryBuild(self.env.SConfActionBuilder, text, extension) del self.env['BUILDERS']['SConfActionBuilder'] if ok: - outputStr = self.lastTarget.get_contents().decode() + outputStr = self.lastTarget.get_text_contents() return (1, outputStr) return (0, "") @@ -739,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: @@ -1000,7 +1042,7 @@ def CheckLib(context, library = None, symbol = "main", compiles without flags. """ - if library == []: + if not library: library = [None] if not SCons.Util.is_List(library): |