From de01f7ea3cd258c893e1262800b96dd85ae89133 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 8 Feb 2019 09:45:15 -0700 Subject: Add textfile tool to defaults PR #3242 added the Textfile and Substfile builders to the default builder list (for issue #3147), but didn't finish the job: the textfile tool needs to be added to the default list of tools as well. This time with a testcase that fails if the tool is not added. Minor doc tweak. Signed-off-by: Mats Wichmann --- doc/generated/builders.gen | 4 ++-- doc/generated/functions.gen | 4 ++++ src/CHANGES.txt | 1 + src/engine/SCons/Tool/__init__.py | 2 ++ src/engine/SCons/Tool/textfile.xml | 4 ++-- test/textfile.py | 4 +++- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index 6f03cd3..dc05443 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -2377,7 +2377,7 @@ and the result replaces the key. -env = Environment(tools = ['default', 'textfile']) +env = Environment(tools=['default']) env['prefix'] = '/usr/bin' script_dict = {'@prefix@': '/bin', '@exec_prefix@': '$prefix'} @@ -2404,7 +2404,7 @@ env.Substfile('bar.in', SUBST_DICT = good_bar) # the SUBST_DICT may be in common (and not an override) substutions = {} -subst = Environment(tools = ['textfile'], SUBST_DICT = substitutions) +subst = Environment(tools=['textfile'], SUBST_DICT=substitutions) substitutions['@foo@'] = 'foo' subst['SUBST_DICT']['@bar@'] = 'bar' subst.Substfile('pgm1.c', [Value('#include "@foo@.h"'), diff --git a/doc/generated/functions.gen b/doc/generated/functions.gen index 617a0a4..9fc9d4b 100644 --- a/doc/generated/functions.gen +++ b/doc/generated/functions.gen @@ -1197,6 +1197,10 @@ Multiple calls to Default are legal, and add to the list of default targets. +As noted above, both forms of this call affect the +same global list of default targets; the +construction environment method applies +construction variable expansion to the targets. diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 8bdafe7..654b58c 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -23,6 +23,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by not using a context manager around Popen.stdout + - Add the textfile tool to the default tool list RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index f3f0630..74dba75 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -1305,6 +1305,8 @@ def tool_list(platform, env): 'tex', 'latex', 'pdflatex', 'pdftex', # Archivers 'tar', 'zip', + # File builders (text) + 'textfile', ], env) tools = ([linker, c_compiler, cxx_compiler, diff --git a/src/engine/SCons/Tool/textfile.xml b/src/engine/SCons/Tool/textfile.xml index 08bbb76..3b4a038 100644 --- a/src/engine/SCons/Tool/textfile.xml +++ b/src/engine/SCons/Tool/textfile.xml @@ -147,7 +147,7 @@ and the result replaces the key. -env = Environment(tools = ['default', 'textfile']) +env = Environment(tools=['default']) env['prefix'] = '/usr/bin' script_dict = {'@prefix@': '/bin', '@exec_prefix@': '$prefix'} @@ -174,7 +174,7 @@ env.Substfile('bar.in', SUBST_DICT = good_bar) # the SUBST_DICT may be in common (and not an override) substutions = {} -subst = Environment(tools = ['textfile'], SUBST_DICT = substitutions) +subst = Environment(tools=['textfile'], SUBST_DICT=substitutions) substitutions['@foo@'] = 'foo' subst['SUBST_DICT']['@bar@'] = 'bar' subst.Substfile('pgm1.c', [Value('#include "@foo@.h"'), diff --git a/test/textfile.py b/test/textfile.py index 46eee34..1d5b3c7 100644 --- a/test/textfile.py +++ b/test/textfile.py @@ -115,6 +115,8 @@ test.write('foo2a.txt', foo2aText) test.write('bar2a.txt', foo2aText) check_times() +# now that textfile is part of default tool list, run one testcase +# without adding it explicitly as a tool to make sure. test.write('SConstruct', """ textlist = ['This line has no substitutions', 'This line has @subst@ substitutions', @@ -125,7 +127,7 @@ sub1 = { '@subst@' : 'most' } sub2 = { '%subst%' : 'many' } sub3 = { '@subst@' : 'most' , '%subst%' : 'many' } -env = Environment(tools = ['textfile']) +env = Environment() t = env.Textfile('text', textlist) # no substitutions -- cgit v0.12