Skip to content

Use py_binary for script execution#199

Open
furtib wants to merge 6 commits intoEricsson:mainfrom
furtib:py-binary
Open

Use py_binary for script execution#199
furtib wants to merge 6 commits intoEricsson:mainfrom
furtib:py-binary

Conversation

@furtib
Copy link
Contributor

@furtib furtib commented Feb 27, 2026

Why:
We should rely on Bazel to run Python scripts and not hack them together ourselves.

What:

  • Created a py_binary target for codechecker_script.py
  • Created a py_binary target for per_file_script.py
  • Replaced expand_template with environment variables in codechecker rule
  • Replaced expand_template with arguments in per_file rule (use_default_shell_env = True, does not allow us to define env variables)

Addresses:
none

@furtib furtib requested review from Szelethus and nettle February 27, 2026 12:28
@furtib furtib self-assigned this Feb 27, 2026
@furtib furtib added the enhancement New feature or request label Feb 27, 2026
@furtib furtib force-pushed the py-binary branch 2 times, most recently from 379462e to 318751b Compare February 27, 2026 13:37
Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

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

@nettle What do you think of the overall direction of this patch? Just the theory, not necesserily the granular stuff.

Copy link
Collaborator

@nettle nettle left a comment

Choose a reason for hiding this comment

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

Looks promising! If it really works for all Bazel versions

"codechecker_script.py",
"per_file_script.py",
],
py_binary(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Right, this is interesting idea!
We just need to make sure it is reliable and stable in all situations

Comment on lines +100 to +101
# Use environment variables instead of expand_template
environment_variables = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

However, using env vars is really creepy :)
I think we should consider arguments instead

@furtib furtib mentioned this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants