Skip to content

Commit

Permalink
GnuToolchain's make_args handle empty values correctly (#17532)
Browse files Browse the repository at this point in the history
test
  • Loading branch information
ErniGH authored Dec 27, 2024
1 parent e9e4bb1 commit 47c3d6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit 47c3d6e

Please sign in to comment.