Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pip/_internal/exceptions/pyproject.py: 83%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

12 statements  

1"""pyproject.toml related pip exceptions.""" 

2 

3from pip._vendor.rich.markup import escape 

4from pip._vendor.rich.text import Text 

5 

6from pip._internal.exceptions._base import DiagnosticPipError 

7 

8 

9class MissingPyProjectBuildRequires(DiagnosticPipError): 

10 """Raised when pyproject.toml has `build-system`, but no `build-system.requires`.""" 

11 

12 reference = "missing-pyproject-build-system-requires" 

13 

14 def __init__(self, *, package: str) -> None: 

15 super().__init__( 

16 message=f"Can not process {escape(package)}", 

17 context=Text( 

18 "This package has an invalid pyproject.toml file.\n" 

19 "The [build-system] table is missing the mandatory `requires` key." 

20 ), 

21 note_stmt="This is an issue with the package mentioned above, not pip.", 

22 hint_stmt=Text("See PEP 518 for the detailed specification."), 

23 ) 

24 

25 

26class InvalidPyProjectBuildRequires(DiagnosticPipError): 

27 """Raised when pyproject.toml an invalid `build-system.requires`.""" 

28 

29 reference = "invalid-pyproject-build-system-requires" 

30 

31 def __init__(self, *, package: str, reason: str) -> None: 

32 super().__init__( 

33 message=f"Can not process {escape(package)}", 

34 context=Text( 

35 "This package has an invalid `build-system.requires` key in " 

36 f"pyproject.toml.\n{reason}" 

37 ), 

38 note_stmt="This is an issue with the package mentioned above, not pip.", 

39 hint_stmt=Text("See PEP 518 for the detailed specification."), 

40 )