Defines a C header file that a primitive may require. The header gets explicitly #included if the dependency is used. include_dirs are passed to the C compiler when the generated extension is compiled separately and needs to include the header.
| 74 | |
| 75 | |
| 76 | class HeaderDep: |
| 77 | """Defines a C header file that a primitive may require. |
| 78 | |
| 79 | The header gets explicitly #included if the dependency is used. |
| 80 | include_dirs are passed to the C compiler when the generated extension |
| 81 | is compiled separately and needs to include the header. |
| 82 | """ |
| 83 | |
| 84 | def __init__( |
| 85 | self, path: str, *, include_dirs: list[str] | None = None, internal: bool = True |
| 86 | ) -> None: |
| 87 | # Relative path from mypyc/lib-rt, e.g. 'strings/librt_strings.h' |
| 88 | self.path: Final = path |
| 89 | self.include_dirs: Final = include_dirs or [] |
| 90 | self.internal: Final = internal |
| 91 | |
| 92 | def __repr__(self) -> str: |
| 93 | return f"HeaderDep(path={self.path!r})" |
| 94 | |
| 95 | def __eq__(self, other: object) -> bool: |
| 96 | return isinstance(other, HeaderDep) and self.path == other.path |
| 97 | |
| 98 | def __hash__(self) -> int: |
| 99 | return hash(("HeaderDep", self.path)) |
| 100 | |
| 101 | def get_header(self) -> str: |
| 102 | return self.path |
| 103 | |
| 104 | |
| 105 | Dependency = Capsule | SourceDep | HeaderDep |
no outgoing calls
no test coverage detected
searching dependent graphs…