Skip to content

BLD: avoid setting an environment variable in a meson.build file #20450

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

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

rgommers
Copy link
Member

This was introduced last month in gh-20232; I commented on it there (https://github.com/scipy/scipy/pull/20232/files#r1524677014) about it maybe being able to cause an issue later. And it just did, see gh-20433. Upgrading Meson in an existing build environment is technically unsupported by Meson, but has always "just worked". Now we hit a corner case on Windows, because when we set an environment variable in a meson.build file, a pickled version of Meson is called and this is less robust to upgrading Meson in the build env.

The fix is a bit more verbose, but should be reliable - the importlib importing is directly copied from how it's done in NumPy's code generation scripts.

@rgommers rgommers added Build issues Issues with building from source, including different choices of architecture, compilers and OS Meson Items related to the introduction of Meson as the new build system for SciPy labels Apr 11, 2024
@rgommers rgommers added this to the 1.14.0 milestone Apr 11, 2024
@rgommers rgommers requested a review from thalassemia April 11, 2024 21:06
@rgommers rgommers requested review from larsoner and ilayn as code owners April 11, 2024 21:06
@github-actions github-actions bot added scipy.linalg Cython Issues with the internal Cython code base labels Apr 11, 2024
This was introduced last month in scipygh-20232; I commented on it there
about it maybe being able to cause an issue later. And it just did,
see scipygh-20433. Upgrading Meson in an existing build environment is
technically unsupported by Meson, but has always "just worked". Now
we hit a corner case on Windows, because when we set an environment
variable in a `meson.build` file, a pickled version of Meson is called
and this is less robust to upgrading Meson in the build env.

The fix is a bit more verbose, but should be reliable - the `importlib`
importing is directly copied from how it's done in NumPy's code
generation scripts.
@ilayn
Copy link
Member

ilayn commented Apr 11, 2024

Interesting indeed. No idea how I end up hitting these corners on Windows but thank you for the surgery anyways.

@thalassemia
Copy link
Contributor

I should’ve known better haha. Thanks for the fix @rgommers!

@lucascolley
Copy link
Member

Feel free to use the green button @thalassemia ;)

@thalassemia thalassemia merged commit de9acc4 into scipy:main Apr 11, 2024
@rgommers rgommers deleted the meson-no-env-usage branch April 12, 2024 08:03
@rgommers
Copy link
Member Author

No idea how I end up hitting these corners on Windows

It's not you, it's Windows :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build issues Issues with building from source, including different choices of architecture, compilers and OS Cython Issues with the internal Cython code base Meson Items related to the introduction of Meson as the new build system for SciPy scipy.linalg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants