Skip to content

Commit 4b43977

Browse files
committed
fixup! Load directory file-api objects
Signed-off-by: Cristian Le <[email protected]>
1 parent 6dade5e commit 4b43977

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/scikit_build_core/file_api/_cattrs_converter.py

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from .model.cache import Cache
1212
from .model.cmakefiles import CMakeFiles
1313
from .model.codemodel import CodeModel, Target
14+
from .model.codemodel import Directory as CodeModelDirectory
15+
from .model.directory import Directory
1416
from .model.index import Index, Reply
1517

1618
T = TypeVar("T")
@@ -41,12 +43,15 @@ def from_json_file(with_path: Dict[str, Any], t: Type[T]) -> T:
4143
return converter.structure_attrs_fromdict({}, t)
4244
path = base_dir / Path(with_path["jsonFile"])
4345
raw = json.loads(path.read_text(encoding="utf-8"))
46+
if t is CodeModelDirectory:
47+
t = Directory # type: ignore[assignment]
4448
return converter.structure_attrs_fromdict(raw, t)
4549

4650
converter.register_structure_hook(CodeModel, from_json_file)
4751
converter.register_structure_hook(Target, from_json_file)
4852
converter.register_structure_hook(Cache, from_json_file)
4953
converter.register_structure_hook(CMakeFiles, from_json_file)
54+
converter.register_structure_hook(CodeModelDirectory, from_json_file)
5055
return converter
5156

5257

0 commit comments

Comments
 (0)