nixpkgs/pkgs/development/python-modules/meson-python/add-build-flags.sh
Alyssa Ross 787af710c6
python3.pkgs.meson-python: run hook in postConfigure
It's not uncommon for packages to modify mesonFlags/mesonFlagsArray in
e.g. preConfigure.  Since the hook was previously run immediately,
these changes wouldn't have been picked up.  To fix this, run the hook
after the configure phase, where we know the list of meson flags will
have been finalized.

Fixes: 70d182be3f ("python3.pkgs.meson-python: populate python build flags with $mesonFlags")
2023-10-13 18:54:11 +00:00

11 lines
384 B
Bash

mesonPythonBuildFlagsHook() {
# Add all of mesonFlags to -Csetup-args for pypa builds
for f in $mesonFlags; do
pypaBuildFlags+=" -Csetup-args=$f"
# This requires pip>23.0.1, see: https://meson-python.readthedocs.io/en/latest/how-to-guides/config-settings.html
pipBuildFlags+=" --config-settings=setup-args=$f"
done
}
postConfigureHooks+=(mesonPythonBuildFlagsHook)