From 7c651e273c4db37f4babd91aaecf26800c50dd79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Thu, 28 Sep 2017 10:21:20 +0200 Subject: New upstream version 3.0.0 --- engine/SCons/SConf.py | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'engine/SCons/SConf.py') diff --git a/engine/SCons/SConf.py b/engine/SCons/SConf.py index e5799ac..c1ab159 100644 --- a/engine/SCons/SConf.py +++ b/engine/SCons/SConf.py @@ -12,7 +12,7 @@ libraries are installed, if some command line options are supported etc. """ # -# Copyright (c) 2001 - 2016 The SCons Foundation +# Copyright (c) 2001 - 2017 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -33,8 +33,9 @@ libraries are installed, if some command line options are supported etc. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import print_function -__revision__ = "src/engine/SCons/SConf.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/SConf.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" import SCons.compat @@ -109,7 +110,7 @@ def _createConfigH(target, source, env): #define %(DEFNAME)s_SEEN """ % {'DEFNAME' : defname}) - t.write(source[0].get_contents()) + t.write(source[0].get_contents().decode()) t.write(""" #endif /* %(DEFNAME)s_SEEN */ """ % {'DEFNAME' : defname}) @@ -131,10 +132,10 @@ def CreateConfigHBuilder(env): _stringConfigH) sconfigHBld = SCons.Builder.Builder(action=action) env.Append( BUILDERS={'SConfigHBuilder':sconfigHBld} ) - for k in _ac_config_hs.keys(): + for k in list(_ac_config_hs.keys()): env.SConfigHBuilder(k, env.Value(_ac_config_hs[k])) - + class SConfWarning(SCons.Warnings.Warning): pass SCons.Warnings.enableWarningClass(SConfWarning) @@ -163,11 +164,11 @@ class ConfigureCacheError(SConfError): # define actions for building text files def _createSource( target, source, env ): fd = open(str(target[0]), "w") - fd.write(source[0].get_contents()) + fd.write(source[0].get_contents().decode()) fd.close() def _stringSource( target, source, env ): return (str(target[0]) + ' <-\n |' + - source[0].get_contents().replace( '\n', "\n |" ) ) + source[0].get_contents().decode().replace( '\n', "\n |" ) ) class SConfBuildInfo(SCons.Node.FS.FileBuildInfo): """ @@ -176,7 +177,7 @@ class SConfBuildInfo(SCons.Node.FS.FileBuildInfo): contains messages of the original build phase. """ __slots__ = ('result', 'string') - + def __init__(self): self.result = None # -> 0/None -> no error, != 0 error self.string = None # the stdout / stderr output when building the target @@ -217,7 +218,7 @@ class Streamer(object): if self.orig: self.orig.flush() self.s.flush() - + class SConfBuildTask(SCons.Taskmaster.AlwaysTask): """ @@ -311,7 +312,7 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask): binfo = self.targets[0].get_stored_info().binfo self.display_cached_string(binfo) raise SCons.Errors.BuildError # will be 'caught' in self.failed - elif is_up_to_date: + elif is_up_to_date: self.display("\"%s\" is up to date." % str(self.targets[0])) binfo = self.targets[0].get_stored_info().binfo self.display_cached_string(binfo) @@ -332,7 +333,7 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask): env_decider=env.decide_source): env_decider(dependency, target, prev_ni) return True - if env.decide_source.func_code is not force_build.func_code: + if env.decide_source.__code__ is not force_build.__code__: env.Decider(force_build) env['PSTDOUT'] = env['PSTDERR'] = s try: @@ -346,7 +347,7 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask): except SystemExit: exc_value = sys.exc_info()[1] raise SCons.Errors.ExplicitExit(self.targets[0],exc_value.code) - except Exception, e: + except Exception as e: for t in self.targets: binfo = SConfBuildInfo() binfo.merge(t.get_binfo()) @@ -396,7 +397,7 @@ class SConfBase(object): """ def __init__(self, env, custom_tests = {}, conf_dir='$CONFIGUREDIR', - log_file='$CONFIGURELOG', config_h = None, _depth = 0): + log_file='$CONFIGURELOG', config_h = None, _depth = 0): """Constructor. Pass additional tests in the custom_tests-dictionary, e.g. custom_tests={'CheckPrivate':MyPrivateTest}, where MyPrivateTest defines a custom test. @@ -457,10 +458,10 @@ class SConfBase(object): If value is None (default), then #define name is written. If value is not none, then #define name value is written. - - comment is a string which will be put as a C comment in the - header, to explain the meaning of the value (appropriate C comments /* and - */ will be put automatically.""" + + comment is a string which will be put as a C comment in the header, to explain the meaning of the value + (appropriate C comments will be added automatically). + """ lines = [] if comment: comment_str = "/* %s */" % comment @@ -608,7 +609,7 @@ class SConfBase(object): ok = self.TryBuild(self.env.SConfActionBuilder, text, extension) del self.env['BUILDERS']['SConfActionBuilder'] if ok: - outputStr = self.lastTarget.get_contents() + outputStr = self.lastTarget.get_contents().decode() return (1, outputStr) return (0, "") @@ -642,7 +643,7 @@ class SConfBase(object): node = self.env.Command(output, prog, [ [ pname, ">", "${TARGET}"] ]) ok = self.BuildNodes(node) if ok: - outputStr = output.get_contents() + outputStr = SCons.Util.to_str(output.get_contents()) return( 1, outputStr) return (0, "") @@ -670,7 +671,7 @@ class SConfBase(object): """Adds all the tests given in the tests dictionary to this SConf instance """ - for name in tests.keys(): + for name in list(tests.keys()): self.AddTest(name, tests[name]) def _createDir( self, node ): @@ -689,7 +690,7 @@ class SConfBase(object): global _ac_config_logs global sconf_global global SConfFS - + self.lastEnvFs = self.env.fs self.env.fs = SConfFS self._createDir(self.confdir) @@ -716,7 +717,7 @@ class SConfBase(object): self.logstream.write('file %s,line %d:\n\tConfigure(confdir = %s)\n' % (tb[0], tb[1], str(self.confdir)) ) SConfFS.chdir(old_fs_dir) - else: + else: self.logstream = None # we use a special builder to create source files from TEXT action = SCons.Action.Action(_createSource, @@ -913,14 +914,14 @@ def CheckType(context, type_name, includes = "", language = None): def CheckTypeSize(context, type_name, includes = "", language = None, expect = None): res = SCons.Conftest.CheckTypeSize(context, type_name, - header = includes, language = language, + header = includes, language = language, expect = expect) context.did_show_result = 1 return res def CheckDeclaration(context, declaration, includes = "", language = None): res = SCons.Conftest.CheckDeclaration(context, declaration, - includes = includes, + includes = includes, language = language) context.did_show_result = 1 return not res @@ -1004,7 +1005,7 @@ def CheckLib(context, library = None, symbol = "main", if not SCons.Util.is_List(library): library = [library] - + # ToDo: accept path for the library res = SCons.Conftest.CheckLib(context, library, symbol, header = header, language = language, autoadd = autoadd) -- cgit v1.2.3