| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
CUSTOM_EXTRACTOR_COOKIE = "custom extractor was here" |
| 4 |
|
| 5 |
|
| 6 |
def custom_extractor(fileobj, keywords, comment_tags, options): |
| 7 |
if "treat" not in options: |
| 8 |
raise RuntimeError(f"The custom extractor refuses to run without a delicious treat; got {options!r}") |
| 9 |
return [(1, next(iter(keywords)), (CUSTOM_EXTRACTOR_COOKIE,), [])] |
| 10 |
|
| 11 |
|
| 12 |
class Distribution: # subset of distutils.dist.Distribution |
| 13 |
def __init__(self, attrs: dict) -> None: |
| 14 |
self.attrs = attrs |
| 15 |
|
| 16 |
def get_name(self) -> str: |
| 17 |
return self.attrs['name'] |
| 18 |
|
| 19 |
def get_version(self) -> str: |
| 20 |
return self.attrs['version'] |
| 21 |
|
| 22 |
@property |
| 23 |
def packages(self) -> list[str]: |
| 24 |
return self.attrs['packages'] |