Skip to content

Commit

Permalink
Fix incorrectly setting name on python_requirements macro (pantsb…
Browse files Browse the repository at this point in the history
…uild#14065)

Closes pantsbuild#14061. Oopsies.

Note that this code path will be removed soon once we finish pantsbuild#12915.

[ci skip-rust]
  • Loading branch information
Eric-Arellano committed Jan 4, 2022
1 parent a6f7492 commit 29be5be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/python/pants/core/goals/tailor.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ def fmt_val(v) -> str:
return f"[{val_str}\n{indent}]"
return repr(v)

is_default_name = self.name == os.path.basename(self.path)
if self.kwargs or not is_default_name:
has_name = self.addressable and self.name != os.path.basename(self.path)
if self.kwargs or has_name:
_kwargs = {
**({} if is_default_name else {"name": self.name}),
**({"name": self.name} if has_name else {}),
**self.kwargs, # type: ignore[arg-type]
}
_kwargs_str_parts = [f"\n{indent}{k}={fmt_val(v)}" for k, v in _kwargs.items()]
Expand Down

0 comments on commit 29be5be

Please sign in to comment.