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

gittip: Use Meson's capture: true for Python 3.6 compatibility #2869

Merged
merged 1 commit into from
Aug 4, 2022

Conversation

kazarmy
Copy link
Member

@kazarmy kazarmy commented Aug 4, 2022

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

This pr fixes the following problem (https://github.com/rizinorg/rizin/runs/7665608906?check_suite_focus=true#step:7:814):

gittip-capture-output

and reverts sys/meson_git_wrapper.py so any lost functionality should also be restored.

Test plan

The fix makes sense. All builds are green.

Closing issues

...

@kazarmy kazarmy merged commit 2588aa8 into rizinorg:dev Aug 4, 2022
called = subprocess.run(args, check=True, capture_output=True)
with open("gittip", "w", encoding="utf8") as f:
f.write(called.stdout.decode("utf8").strip())
called = subprocess.run(args, check=True)

Choose a reason for hiding this comment

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

This is wrong, and using capture: true in Meson is bad -- it causes this python script to be run by meson --internal exe, which imports lots of stuff and is very slow and obscures the command line.

You don't need to throw the baby out with the bathwater. capture_output is python 3.7, sure, but it's also literally an alias for stdout=subprocess.PIPE, stderr=subprocess.PIPE and it's extremely easy to make that work with python 3.6.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks a lot for this hint!

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay #2873 ... Using stdout=subprocess.PIPE changes the behavior of sys/meson_git_wrapper.py away from expected behavior, but hopefully this divergence is only temporary.

Copy link

@eli-schwartz eli-schwartz Aug 5, 2022

Choose a reason for hiding this comment

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

Great. Happy to help. :)

Capture exists solely for the benefit of tools that don't support specifying the output file and usually cannot be modified as they are external processing tools rather than internal helper scripts, so you don't really have a choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants