Skip to content

Commit

Permalink
Escape the package name, allowing rich to stylize URLs and links
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Dec 12, 2021
1 parent 961eb6f commit 6b31f83
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pip/_internal/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from pip._vendor.requests.models import Request, Response
from pip._vendor.rich.console import Console, ConsoleOptions, RenderResult
from pip._vendor.rich.markup import escape
from pip._vendor.rich.text import Text

if TYPE_CHECKING:
Expand Down Expand Up @@ -182,7 +183,7 @@ class MissingPyProjectBuildRequires(DiagnosticPipError):

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

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

0 comments on commit 6b31f83

Please sign in to comment.