Skip to content
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

GnuToolchain's make_args handle empty values correctly #17532

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion conan/tools/gnu/gnutoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def _filter_list_empty_fields(v):

@staticmethod
def _dict_to_list(flags):
return [f"{k}={v}" if v else k for k, v in flags.items()]
return [f"{k}={v}" if v is not None else k for k, v in flags.items()]

@property
def cxxflags(self):
Expand Down
4 changes: 4 additions & 0 deletions test/unittests/tools/gnu/test_gnutoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,9 @@ def test_update_or_prune_any_args(cross_building_conanfile):
assert "'--force" not in new_autoreconf_args
# Add new value to make_args
at.make_args.update({"--new-complex-flag": "new-value"})
at.make_args.update({"--new-empty-flag": ""})
at.make_args.update({"--new-no-value-flag": None})
new_make_args = cmd_args_to_string(GnuToolchain._dict_to_list(at.make_args))
assert "--new-complex-flag=new-value" in new_make_args
assert "--new-empty-flag=" in new_make_args
assert "--new-no-value-flag" in new_make_args and "--new-no-value-flag=" not in new_make_args
Loading