- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.8k
          interpreter: add depend_files kwarg to run_command()
          #15016
        
          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
          
     Closed
      
      
    
  
     Closed
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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.
Given the kwarg is part of
func_run_commandI don't know why it's being read+used in the totally differentrun_command_impl, but it is the cause of the CI failures.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.
func_run_command()just forwards torun_command_impl(), and the latter shares the type-definition of thekwargsargument.I think the CI failure is because this should read:
I wonder, though, why this didn't trigger errors in my local tests. I used:
And this worked fine. Hmm. But maybe I am missing something here. How exactly would you adjust
func_run_command()to support the option?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.
If I got this right, then
func_run_command()properly fills in the default value inkwargs, and as such I get an emptydepend_fileswhen called viarun_command()in meson build files. However, there are 2 other users of the actual implementation offunc_run_command(), which isrun_command_impl(), and those do not fill in defaults but pass kwargs manually (and explicitly specify all kwargs).Do you prefer to update explicit users to specify all options, or should I use the
kwargs.get(..., [])style?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 already told you what I want, but I can explain the distinction between the two and why your analysis doesn't apply in this case. Sorry for not elucidating earlier.
We have two functions:
Most of the logic for the former (technically before this PR, all of it) needs to be forwarded regardless, because it tunes the details of the command spawning itself. It isn't work that occurs independently beforehand. Even though other uses don't necessarily need to control these details,
run_command_implmust somehow accept knobs for e.g. env, and it could be done via a dict kwarg or via separate arguments but we happened to use this.depend_files is unnecessary to expose to run_command_impl, it can live wholly inside of func_run_command which means avoiding unnecessary complexity inside other internal callers of run_command_impl.