Skip to content

Commit e144173

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 d2133b4 commit e144173

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Diff for: src/pip/_internal/exceptions.py

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

190190
def __init__(self, *, package: str) -> None:
191191
super().__init__(
192-
message=f"Can not process {package}",
193-
context=(
192+
message=Text(f"Can not process {package}"),
193+
context=Text(
194194
"This package has an invalid pyproject.toml file.\n"
195-
R"The \[build-system] table is missing the mandatory `requires` key."
195+
"The [build-system] table is missing the mandatory `requires` key."
196196
),
197197
note_stmt="This is an issue with the package mentioned above, not pip.",
198-
hint_stmt=Text("See PEP 518 for the detailed specification."),
198+
hint_stmt="See PEP 518 for the detailed specification.",
199199
)
200200

201201

@@ -206,14 +206,13 @@ class InvalidPyProjectBuildRequires(DiagnosticPipError):
206206

207207
def __init__(self, *, package: str, reason: str) -> None:
208208
super().__init__(
209-
message=f"Can not process {package}",
209+
message=Text(f"Can not process {package}"),
210210
context=Text(
211211
"This package has an invalid `build-system.requires` key in "
212-
"pyproject.toml.\n"
213-
f"{reason}"
212+
f"pyproject.toml.\n{reason}"
214213
),
215214
note_stmt="This is an issue with the package mentioned above, not pip.",
216-
hint_stmt=Text("See PEP 518 for the detailed specification."),
215+
hint_stmt="See PEP 518 for the detailed specification.",
217216
)
218217

219218

0 commit comments

Comments
 (0)