From c8ec7bc757b4db335597f9fdd4de91bdc54783df Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 14:17:58 +0000 Subject: [PATCH] Address code review: improve arch flag handling - Extract target_arch_flag to variable to reduce duplication - Add .strip() calls to handle trailing spaces in environment variables - Ensure proper spacing in concatenated flags Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- scripts/mk_unix_dist.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/mk_unix_dist.py b/scripts/mk_unix_dist.py index edd143f52..4df68d4c7 100644 --- a/scripts/mk_unix_dist.py +++ b/scripts/mk_unix_dist.py @@ -155,10 +155,11 @@ def mk_build_dir(path): import platform if platform.system() == 'Darwin': # On macOS, we can cross-compile using -arch flag + target_arch_flag = ' -arch x86_64' myvar = { - "CXXFLAGS": os.environ.get("CXXFLAGS", "") + " -arch x86_64", - "CFLAGS": os.environ.get("CFLAGS", "") + " -arch x86_64", - "LDFLAGS": os.environ.get("LDFLAGS", "") + " -arch x86_64" + "CXXFLAGS": (os.environ.get("CXXFLAGS", "").strip() + target_arch_flag).strip(), + "CFLAGS": (os.environ.get("CFLAGS", "").strip() + target_arch_flag).strip(), + "LDFLAGS": (os.environ.get("LDFLAGS", "").strip() + target_arch_flag).strip() } env.update(myvar) if subprocess.call(opts, env=env) != 0: