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

ENH: raise SystemExit when calling meson fails #231

Merged
merged 3 commits into from
Dec 22, 2022

Conversation

dnicolodi
Copy link
Member

Fixes #228.

@dnicolodi
Copy link
Member Author

This fixes the case when Meson errors out. However, the new configuration handling code raises ConfigurationError exceptions that are not handled gracefully. Maybe the pep517 hooks should be wrapped in something that turns these into nicer error messages. I don't know what is the recommended pep517 way of doing this, though.

@@ -649,7 +649,9 @@ def _get_config_key(self, key: str) -> Any:
def _proc(self, *args: str) -> None:
"""Invoke a subprocess."""
print('{cyan}{bold}+ {}{reset}'.format(' '.join(args), **_STYLES))
subprocess.check_call(list(args), env=self._env)
r = subprocess.run(list(args), env=self._env)
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend always specifying check= to subprocess.run to clarify intent. There's a check (bugbear, perhaps?) that looks for this.

@eli-schwartz
Copy link
Member

What is the status of this PR? People are reporting the failures directly to Meson itself now.

As far as I can tell, this flawlessly solves the problem some of the time, and doesn't touch the code involved in some other times. It seems obviously correct (incremental improvements FTW) and solves real problems for people, so why delay in merging it?

@FFY00
Copy link
Member

FFY00 commented Dec 21, 2022

What is the status of this PR? People are reporting the failures directly to Meson itself now.

I am almost finished in #87, after that is in, I will merge this too and make a release.

@dnicolodi
Copy link
Member Author

On user input error (either command line or configuration file) we now raise ConfigError and nothing catches that. I wanted to fix that too before merging. But this can come at a later time.

@rgommers
Copy link
Contributor

I am almost finished in #87, after that is in, I will merge this too and make a release.

@FFY00 I recommend leaving enough time pre and post merge of that PR, so we're sure it's in good shape when it is released. This PR doesn't have to wait for that one.

@dnicolodi
Copy link
Member Author

I added handling of the exceptions raised for configuration errors. Please have a look.

@FFY00
Copy link
Member

FFY00 commented Dec 22, 2022

@FFY00 I recommend leaving enough time pre and post merge of that PR, so we're sure it's in good shape when it is released. This PR doesn't have to wait for that one.

Yeah, it makes sense to release this first 👍

@FFY00 FFY00 merged commit 795d2f8 into mesonbuild:main Dec 22, 2022
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.

raise SystemExit on build failure
5 participants