Skip to content

Commit 6b31f83

Browse files
committed
Escape the package name, allowing rich to stylize URLs and links
1 parent 961eb6f commit 6b31f83

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pip/_internal/exceptions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from pip._vendor.requests.models import Request, Response
99
from pip._vendor.rich.console import Console, ConsoleOptions, RenderResult
10+
from pip._vendor.rich.markup import escape
1011
from pip._vendor.rich.text import Text
1112

1213
if TYPE_CHECKING:
@@ -182,7 +183,7 @@ class MissingPyProjectBuildRequires(DiagnosticPipError):
182183

183184
def __init__(self, *, package: str) -> None:
184185
super().__init__(
185-
message=Text(f"Can not process {package}"),
186+
message=f"Can not process {escape(package)}",
186187
context=Text(
187188
"This package has an invalid pyproject.toml file.\n"
188189
"The [build-system] table is missing the mandatory `requires` key."
@@ -199,7 +200,7 @@ class InvalidPyProjectBuildRequires(DiagnosticPipError):
199200

200201
def __init__(self, *, package: str, reason: str) -> None:
201202
super().__init__(
202-
message=Text(f"Can not process {package}"),
203+
message=f"Can not process {escape(package)}",
203204
context=Text(
204205
"This package has an invalid `build-system.requires` key in "
205206
f"pyproject.toml.\n{reason}"

0 commit comments

Comments
 (0)