Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions setuptools_rust/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,16 @@ def build_extension(
*rustc_args,
]

if rustflags:
existing_rustflags = env.get("RUSTFLAGS")
if existing_rustflags is not None:
rustflags.append(existing_rustflags)
new_rustflags = " ".join(rustflags)
env["RUSTFLAGS"] = new_rustflags
# order is important
new_rustflags = list(filter(None, (rustflags, os.getenv("RUSTFLAGS"))))

if new_rustflags:
new_rustflags_str = " ".join(new_rustflags)
env["RUSTFLAGS"] = new_rustflags_str

# print RUSTFLAGS being added before the command
if not quiet:
print(f"[RUSTFLAGS={new_rustflags}]", end=" ", file=sys.stderr)
print(f"[RUSTFLAGS={new_rustflags_str}]", end=" ", file=sys.stderr)

if not quiet:
print(" ".join(command), file=sys.stderr)
Expand Down