From 1f1491d32403c94ced8d1f041165b2f02b50f2b7 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Wed, 16 Oct 2024 16:41:44 -0700 Subject: [PATCH] Fix application of global environment variables in configure phase --- metapkg/targets/base.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/metapkg/targets/base.py b/metapkg/targets/base.py index 2bf2334..e54cace 100644 --- a/metapkg/targets/base.py +++ b/metapkg/targets/base.py @@ -1954,7 +1954,7 @@ def sh_append_global_flags( args = {} conf_args = dict(args) for k, v in self.target.get_global_env(self).items(): - self.sh_append_flags(conf_args, k, [v]) + self.sh_replace_flags(conf_args, k, [v]) if global_cflags: self.sh_append_flags(conf_args, "CFLAGS", global_cflags) if global_cxxflags: @@ -2060,6 +2060,36 @@ def sh_prepend_quoted_flags( ) -> None: self.sh_combine_quoted_flags(args, key, flags, sep=sep, how="prepend") + def sh_replace_flags( + self, + args: dict[str, str | pathlib.Path | None], + key: str, + flags: list[str] | tuple[str, ...], + *, + sep: str = '" "', + ) -> None: + self.sh_replace_quoted_flags( + args, + key, + self.sh_quote_flags(flags), + sep=sep, + ) + + def sh_prepend_flags( + self, + args: dict[str, str | pathlib.Path | None], + key: str, + flags: list[str] | tuple[str, ...], + *, + sep: str = '" "', + ) -> None: + self.sh_prepend_quoted_flags( + args, + key, + self.sh_quote_flags(flags), + sep=sep, + ) + def sh_append_flags( self, args: dict[str, str | pathlib.Path | None],