Skip to content

Commit 7d4d84e

Browse files
committed
Clean up where Text is used to wrap diagnostic messages.
This is only necessary on messages which may contain `[`, which needs to be escaped before printing with rich, since rich treats them as output formats.
1 parent 135d64b commit 7d4d84e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/pip/_internal/exceptions.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,13 @@ class MissingPyProjectBuildRequires(DiagnosticPipError):
182182

183183
def __init__(self, *, package: str) -> None:
184184
super().__init__(
185-
message=f"Can not process {package}",
186-
context=(
185+
message=Text(f"Can not process {package}"),
186+
context=Text(
187187
"This package has an invalid pyproject.toml file.\n"
188-
R"The \[build-system] table is missing the mandatory `requires` key."
188+
"The [build-system] table is missing the mandatory `requires` key."
189189
),
190190
note_stmt="This is an issue with the package mentioned above, not pip.",
191-
hint_stmt=Text("See PEP 518 for the detailed specification."),
191+
hint_stmt="See PEP 518 for the detailed specification.",
192192
)
193193

194194

@@ -199,14 +199,13 @@ class InvalidPyProjectBuildRequires(DiagnosticPipError):
199199

200200
def __init__(self, *, package: str, reason: str) -> None:
201201
super().__init__(
202-
message=f"Can not process {package}",
202+
message=Text(f"Can not process {package}"),
203203
context=Text(
204204
"This package has an invalid `build-system.requires` key in "
205-
"pyproject.toml.\n"
206-
f"{reason}"
205+
f"pyproject.toml.\n{reason}"
207206
),
208207
note_stmt="This is an issue with the package mentioned above, not pip.",
209-
hint_stmt=Text("See PEP 518 for the detailed specification."),
208+
hint_stmt="See PEP 518 for the detailed specification.",
210209
)
211210

212211

0 commit comments

Comments
 (0)