Skip to content

Commit

Permalink
Fix the new tool lockfile deprecation message. (cherrypick of #19565) (
Browse files Browse the repository at this point in the history
…#19571)

When displaying the list of requirements you need in your new tool
lockfile, it called `self.requirements`, which used to just be a helper
function to return the old-style requirements. But at some point it
became an option specifying the new-style requirements, and this
callsite wasn't updated. It is now.

Note: this code was deleted from main, so this is a cherry-pick from
2.17.x.
  • Loading branch information
benjyw authored Aug 9, 2023
1 parent fb4ad81 commit 45bc61c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class PythonToolRequirementsBase(Subsystem):
2. If not, you can set up a new resolve as described at the link above.
Either way, the resolve you choose should provide the requirements currently set
by the `requirements` option for this tool, which you can see
by the `version` and `extra-requirements` options for this tool, which you can see
by running `pants help-advanced {cls.options_scope}`.
"""
),
Expand Down Expand Up @@ -271,9 +271,10 @@ def lockfile(self) -> str:
# about the remedy. We will only display this note if the invocation actually
# tries to use the tool, whereas the deprecations will display on options parsing,
# so this is just a best-effort attempt to be helpful when we can.
tool_reqs = [self.version, *self.extra_requirements]
logger.warning(
f"Note: the resolve you use for the {self.options_scope} tool must "
f"provide these requirements:" + "\n\n" + "\n".join(self.requirements) + "\n"
f"provide these requirements:" + "\n\n" + "\n".join(tool_reqs) + "\n"
)
return self._lockfile

Expand Down

0 comments on commit 45bc61c

Please sign in to comment.