Skip to content

Add notes to Get/SetOption manpage entries#4865

Open
mwichmann wants to merge 2 commits into
SCons:masterfrom
mwichmann:doc/getoption
Open

Add notes to Get/SetOption manpage entries#4865
mwichmann wants to merge 2 commits into
SCons:masterfrom
mwichmann:doc/getoption

Conversation

@mwichmann
Copy link
Copy Markdown
Collaborator

@mwichmann mwichmann commented Jun 5, 2026

Options are stored in an internal data structure defined by the optparse module, and despite the comments that you can deduce the type from the command-line option doc, it's not always obvious. Added an annotation to the Notes column in an attempt to be more explicit.

One option value which defaulted to None now defaults to 0 - that's climb_up, which holds a code indicating which of the "hunt for SConstruct according to this algorithm" options was selected - there was no reason to use None here.

Note that there are four option values that could have a value of None, where this is not included in the new table info. The option-defining code could be updated for these four to say default="" instead of default=None without apparently affecting operation at all, but I didn't include such a change in this PR (yet?).

  1. cache_debug defaults to None, falsy "" would work fine:
            if cache_debug == '-':
                self.debugFP = sys.stdout
            elif cache_debug:
                def debug_cleanup(debugFP) -> None:
                    debugFP.close()

                self.debugFP = open(cache_debug, 'w')
                atexit.register(debug_cleanup, self.debugFP)
            else:
                self.debugFP = None
  1. diskcheck defaults to None, falsy "" would work fine:
    if options.diskcheck:
        SCons.Node.FS.set_diskcheck(options.diskcheck)
  1. profile_file defaults to None, falsy "" would work fine:
    elif options.profile_file:
        from cProfile import Profile
  1. taskmastertrace_file defaults to None, falsy "" would work fine:
        if not trace:
            self.trace = False

And one option that legitimately needs an additional sentinel, so this one was added to the doc table:

  1. site_dir defaults to None. In this case, we do want to distinguish between the case where there's been no option affecting this, and the case where someone asked for site dir reading to be disabled, so a single empty string wouldn't do in this case.
    # if site_dir unchanged from default None, neither --site-dir
    # nor --no-site-dir was seen, use SCons default
    if options.site_dir is None:
        _load_all_site_scons_dirs(d.get_internal_path())
    elif options.site_dir:  # if a dir was set, use it
        _load_site_scons_dir(d.get_internal_path(), options.site_dir)

            return

This is a doc-only change.

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

@mwichmann mwichmann moved this to In review in Next Release Jun 5, 2026
@mwichmann mwichmann added this to the NextRelease milestone Jun 5, 2026
Options are stored in an internal data structure defined by the optparse
module, and despite the comments that you can deduce the type from the
command-line option doc, it's not always obvious.  Added an annotation
to the Notes column in an attempt to be more explicit.

Signed-off-by: Mats Wichmann <mats@linux.com>
In the GetOption table, all the corresponding options pointed
to the same entry, but -D and -U should point to their own entries.

Signed-off-by: Mats Wichmann <mats@linux.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant