|
5 | 5 | from abc import ABC, abstractmethod |
6 | 6 | from enum import Enum |
7 | 7 | from pathlib import Path |
8 | | -from typing import Type, TypeVar |
| 8 | +from typing import Optional, Type, TypeVar |
9 | 9 |
|
10 | 10 | from pydantic import BaseModel |
| 11 | +from pydantic.fields import Field |
11 | 12 |
|
12 | 13 |
|
13 | 14 | class TargetEnum(Enum): |
@@ -40,16 +41,16 @@ class CPPythonData(BaseModel): |
40 | 41 | generator: str |
41 | 42 | target: TargetEnum |
42 | 43 | dependencies: dict[str, str] = {} |
43 | | - install_path: Path |
| 44 | + install_path: Path = Field(alias="install-path") |
44 | 45 |
|
45 | 46 |
|
46 | 47 | class PyProject(BaseModel): |
47 | 48 | """ |
48 | 49 | pyproject.toml schema |
49 | 50 | """ |
50 | 51 |
|
51 | | - pep_621: PEP621 |
52 | | - cppython_data: CPPythonData |
| 52 | + project: PEP621 |
| 53 | + cppython: Optional[CPPythonData] |
53 | 54 |
|
54 | 55 |
|
55 | 56 | class API(ABC): |
@@ -131,6 +132,13 @@ def write_pyproject(self) -> None: |
131 | 132 | """ |
132 | 133 | raise NotImplementedError() |
133 | 134 |
|
| 135 | + @abstractmethod |
| 136 | + def print(self, string: str) -> None: |
| 137 | + """ |
| 138 | + Prints the given string into the Interface IO |
| 139 | + """ |
| 140 | + raise NotImplementedError() |
| 141 | + |
134 | 142 |
|
135 | 143 | class Generator(Plugin, API): |
136 | 144 | """ |
@@ -165,9 +173,15 @@ def data_type() -> Type[GeneratorData]: |
165 | 173 | raise NotImplementedError() |
166 | 174 |
|
167 | 175 | @abstractmethod |
168 | | - def install_generator(self) -> bool: |
| 176 | + def downloaded(self) -> bool: |
| 177 | + """ |
| 178 | + Returns whether the generator needs to be downloaded |
| 179 | + """ |
| 180 | + raise NotImplementedError() |
| 181 | + |
| 182 | + @abstractmethod |
| 183 | + def download(self) -> None: |
169 | 184 | """ |
170 | | - Installs the external tooling required by the generator if necessary |
171 | | - Returns whether anything was installed or not |
| 185 | + Installs the external tooling required by the generator |
172 | 186 | """ |
173 | 187 | raise NotImplementedError() |
0 commit comments