-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Add support for scanning multiple entries in an action string #3483
Add support for scanning multiple entries in an action string #3483
Conversation
This change adds support for scanning multiple entries in an action string in order to better support the following use cases: 1. A file is provided in an action string and should be taken as a dependency. For example, an action string "$PERL somefile.pl". 2. An action string actually has two actions separated by &&. For example, "cd <some_dir> && $ZIP <args>". Adding support for #1 actually allows us to fix the test IMPLICIT_COMMAND_DEPENDENCIES.py on Windows, which was previously treating a Python file as executable even on Windows. This was causing tests to repeatedly open the default handler of Python files, which if set to Visual Studio causes DDE hangs. This test is fixed because now we can have the action string specify python as the first command and still take an implicit dependency on the script, which is now the second command.
Reverts some of the changes I made previously in my diff.
That was missing in the codecov report.
src/engine/SCons/Action.py
Outdated
if p: | ||
res.append(env.fs.File(p)) | ||
else: | ||
# Try to find the dependency in any source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think In general including path into repo is deprecated. Should just look for non-repo file. There's a way to query if File is known without creating the node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So are you saying the “else” case should be removed because repo support is not needed?
Changes: 1. Remove repository code. 2. Only use env.WhereIs() if it's the first entry in a group. 3. Avoid duplicate sources if they are in another variable (e.g. LIBS).
Good work. Also right now looks like you have three options: no Implicit, only first argument, or all arguments. I think it could be useful to be able to specify to process the first N arguments and/or a list of which arguments. |
Thanks for the feedback. Turning off IMPLICIT_COMMAND_DEPENDENCIES was a mistake, a remnant of my older change modifying the default behavior. I have reverted that change. I will also look at updating the documentation and CHANGES.txt. I would prefer to avoid customizing the behavior any further. I understand that we don't want to change the current behavior of IMPLICIT_COMMAND_DEPENDENCIES and the default behavior. Three main reasons:
|
Since you can set. |
In my opinion, if someone is going to go to the trouble of overriding IMPLICIT_COMMAND_DEPENDENCIES for a specific action, they should just use env.Depends instead. The benefit of implicit command dependency scanning is having a safety net for people not specifying their dependencies correctly. Specifying dependencies manually is always preferred, but this page is useful for large codebases where people aren’t always doing it correctly. That said, if you won’t accept the PR without this change then I will do it. So I can better understand what you are asking for, here is what I understand you to be requesting: IMPLICIT_COMMAND_DEPENDENCIES value possibilities: 0/False: no implicit dependencies (as before) |
Since values in Command can vary by environment and/or overrides and those values may need to be added to implicit dependencies, allowing more control over the implicit scanning of command line can provide value. I was thinking:
Seems like you're already 95% of the way to supporting a list. IMHO.. if you need to use env.Depends() you've done something wrong and/or SCons needs to do more. (for 90% of the cases) |
I have updated the PR with support for |
This change adds support for scanning multiple entries in an action string in order to better support the following use cases:
Adding support for #1 actually allows us to fix the test IMPLICIT_COMMAND_DEPENDENCIES.py on Windows, which was previously treating a Python file as executable even on Windows. This was causing tests to repeatedly open the default handler of Python files, which if set to Visual Studio causes DDE hangs. This test is fixed because now we can have the action string specify python as the first command and still take an implicit dependency on the script, which is now the second command.
Contributor Checklist:
master/src/CHANGES.txt
directory (and read theREADME.txt
in that directory)