From a14625286340ed5aba3d5103f40c5b3189f74a64 Mon Sep 17 00:00:00 2001 From: Roshan Ramani Date: Thu, 8 Oct 2026 20:52:29 +0530 Subject: [PATCH] Fix the second Value() example in the manpage The example passed Value(output) and Value(input) to the builder, which wraps each Node in a new Value instead of using it, and nothing depended on the target, so the builder never ran. Use the Nodes directly and write the updated Value to a file. Fixes #4499. Assisted-by: Claude Opus 5.5 Signed-off-by: Roshan Ramani --- CHANGES.txt | 5 +++++ RELEASE.txt | 2 ++ SCons/Environment.xml | 13 +++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index ab5e5dddc..76a41f1fe 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -40,6 +40,11 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER falls back to the field, which names the XSL-NS branch outright. + From Roshan Ramani: + - Fix the second Value() example in the manpage, which never ran its + builder: it wrapped the Value Nodes in another Value() and nothing + depended on the target. Fixes #4499. + From Mats Wichmann: - Add more unit tests for UNC path handling. These tests expose some current issues so they are marked expectedFailure. The intent is to diff --git a/RELEASE.txt b/RELEASE.txt index ec2bad6a0..bb150b904 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -79,6 +79,8 @@ DOCUMENTATION - Removed the out-of-date table of option names for SetOption and GetOption and instead point to the maintained tables in Appendix D. +- Fixed the second Value() example in the manpage, which did not work. + * Added scons-ai.md, a condensed version of the manpage intended for consumption by AI tools, built into build/doc/MD. It keeps every documented option, tool, builder, function and construction variable together with its diff --git a/SCons/Environment.xml b/SCons/Environment.xml index 5cac483ba..fb16f7e35 100644 --- a/SCons/Environment.xml +++ b/SCons/Environment.xml @@ -3625,7 +3625,6 @@ the name parameter was added. Examples: - env = Environment() @@ -3659,7 +3658,17 @@ input = env.Value('after') # Attach a builder named UpdateValue to the construction environment # using the 'build_value' action function above. env['BUILDERS']['UpdateValue'] = Builder(action=build_value) -env.UpdateValue(target=Value(output), source=Value(input)) +env.UpdateValue(target=output, source=input) + +def write_value(target, source, env): + """Action function to write the built value of $SOURCE into $TARGET.""" + with open(target[0], 'wb') as f: + f.write(source[0].read()) + +# A Value Node is only built when a target being built depends on it, +# so write the updated Value to a file. output.txt contains "after". +env['BUILDERS']['WriteValue'] = Builder(action=write_value) +env.WriteValue(target='output.txt', source=output)