Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the way Tool modules add cmdline options for themselves #3455

Open
mwichmann opened this issue Sep 28, 2019 · 0 comments
Open

Improve the way Tool modules add cmdline options for themselves #3455

mwichmann opened this issue Sep 28, 2019 · 0 comments

Comments

@mwichmann
Copy link
Collaborator

mwichmann commented Sep 28, 2019

These observations come out of issue #3007 :
If a tool module chooses to add command-line options which only it will consume, the behavior isn't always what you might expect. As of this writing, one internal tool module, install.py, does this. It uses AddOption in its generate function, which means the option is only added to SCons if the tool's generate is actually called.

  • asking for --help will not go through a code path that calls the tool's generate, so the option's help text never shows up.
  • there are various circumstances under which the option can be missing, leading to confusing errors when an option you may have documented for your users fails. For example, with the install tool, calling scons --install-sandbox=zzz when the SConstruct doesn't have an install in it errors out:
    SCons Error: no such option: --install-sandbox   
    

I don't have a general solution for the problem at the moment. Some questions to ponder:

  • Is AddOption the right way to add an option in a tool, or should some more internal method be used?
  • Should tools in fact ever do this? Is it different for included-in-scons tools vs. user-written tools?
  • is there guidance we can give to tool writers to help get it right?
@bdbaddog bdbaddog changed the title tool-specific cmdline options aren't always obvious Add way for tools to add command line arguments which would show up in -h when appropriate Sep 29, 2019
@bdbaddog bdbaddog changed the title Add way for tools to add command line arguments which would show up in -h when appropriate Add way for Tool()'s to add command line arguments which would show up in -h when appropriate Sep 29, 2019
@mwichmann mwichmann changed the title Add way for Tool()'s to add command line arguments which would show up in -h when appropriate Improve the way Tool modules add cmdline options for themselves Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants