Skip to content

Fix four documentation examples that were not valid Python - #4919

Merged
bdbaddog merged 3 commits into
SCons:masterfrom
rawsun007:doc-broken-examples
Oct 14, 2026
Merged

bdbaddog merged 3 commits into
SCons:masterfrom
rawsun007:doc-broken-examples

Conversation

@rawsun007

Copy link
Copy Markdown
Contributor

Following up on the comment in #4918 about manpage examples rotting. I ran every <example_commands> and <programlisting> block under SCons/ and doc/user/ through Python's parser and went through the failures. Most are intentional (shell output, ... placeholders, C sources). These four are plain mistakes:

  • Environment.xml, Command(): env.Command(env.Dir('$DISTDIR')), None, make_distdir) has a stray ).
  • Tool/msvc.xml, MSVC_VERSION: env['MSVC_VERSION'] = '14.2 is missing its closing quote.
  • Tool/packaging/packaging.xml, X_RPM_EXTRADEFS: the two %define strings have no comma between them, so Python joins them into one string.
  • doc/user/output.xml, the Progress() callable: def progress_function(node) has no colon, and count += 1 raises UnboundLocalError without global count.

I ran the corrected Command() and Progress() examples in an SConstruct with scripts/scons.py, and both work. bin/docs-validate.py passes. The doc/generated/*.gen copies still have the old text; I left them alone because they get regenerated at release time.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation

No test was added, because this only changes documentation examples. RELEASE.txt is not updated, since its DOCUMENTATION section says to leave out individual typo fixes.

Written by Claude Code (Claude Opus 5.5) under my account, as the Assisted-by: trailer says. It came from a scan of the examples, not from an issue.

A stray parenthesis in the Command() example, an unterminated string
in the MSVC_VERSION example, a missing comma that joined the two
X_RPM_EXTRADEFS strings into one, and a Progress() callable in the
user guide missing a colon and a global declaration.

Assisted-by: Claude Opus 5.5
Signed-off-by: Roshan Ramani <roshanramani.dev@gmail.com>
@mwichmann

Copy link
Copy Markdown
Collaborator

These all look good at an initial glance.

@bdbaddog
bdbaddog merged commit bc9712b into SCons:master Oct 14, 2026
11 of 12 checks passed
@mwichmann mwichmann added this to the NextRelease milestone Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants