Skip to content

Add internal routines to remove args and targets #4714

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mwichmann
Copy link
Collaborator

@mwichmann mwichmann commented Apr 17, 2025

Adds SCons.Script._Remove_Target and SCons.Script._Remove_Argument to allow taking away values placed the public attributes BUILD_TARGETS, COMMAND_LINE_TARGETS, ARGUMENTS and ARGLIST. Part two of three harvesting from old PR #3799 (the short-option piece was merged as part of #4598). Intended customer will be the Options logic,

Unit tests created, also for existing SCons.Script._Add_Targets and SCons.Script._Add_Arguments.

There is no public visibility, so no doc changes (except for docstrings for the API docs)

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 added the args_and_options options processing, arguments, get/setoption and their relationshiop label Apr 17, 2025
@mwichmann mwichmann moved this to In review in Next Release Apr 17, 2025
Adds SCons.Script._Remove_Target and SCons.Script._Remove_Argument to
allow taking away values placed the public attributes BUILD_TARGETS,
COMMAND_LINE_TARGETS, ARGUMENTS and ARGLIST. Part two of three harvesting
from old PR SCons#3799 (the short-option piece was merged as part of SCons#4598).
Intended customer will be the Options logic,

Unit tests created, also for existing SCons.Script._Add_Targets and
SCons.Script._Add_Arguments.

Signed-off-by: Mats Wichmann <[email protected]>
@mwichmann mwichmann force-pushed the feature/remove_args_targs branch from f56175b to 7015496 Compare April 17, 2025 16:25
@mwichmann
Copy link
Collaborator Author

mwichmann commented Apr 17, 2025

Found a niggly error in the docstrings (I misspelled versionadded with an extra trailing d so it didn't generate into the apidoc), since it affects nothing functional, I just force-pushed the correction.

@@ -30,16 +30,16 @@
some other module. If it's specific to the "scons" script invocation,
it goes here.
"""

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this section is just a sort, not a change. It will never be possible to make checkers entirely happy here, because there's some code that has to run before some imports to get things right. Didn't feel like tagging every single import following the code bits, just did one that's well separated from the general import section (see line 138)

ARGLIST.remove((a, b))

# Remove first in case no matching values left in ARGLIST
ARGUMENTS.pop(a, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand what this is doing? Is a an integer? I thought list's pop() to an int?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh IC.. And used pop() so if it's not in ARGUMENTS it won't throw an exception?
I think the comment is what's throwing me off.
Should be something like

# Now delete the argument from the ARGUMENTS dict

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the way it was written in #3799 - I can think about reword. It is a bit hokey - it's alluding to the need to possibly refill ARGUMENTS if there were other instances of the variable in ARGLIST (which I assume is an implementation choice we agree with?). I'd propose just removing the comment altogether, and slightly tweaking the following one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
args_and_options options processing, arguments, get/setoption and their relationshiop
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

2 participants