Skip to content

Commit 1b10766

Browse files
committed
Load directory file-api objects
Signed-off-by: Cristian Le <[email protected]>
1 parent d1aaf2d commit 1b10766

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/scikit_build_core/file_api/reply.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
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
1415
from .model.directory import Directory
1516
from .model.index import Index
1617

@@ -51,10 +52,14 @@ def make_class(self, data: InputDict, target: Type[T]) -> T:
5152
Convert a dict to a dataclass. Automatically load a few nested jsonFile classes.
5253
"""
5354
if (
54-
target in {CodeModel, Target, Cache, CMakeFiles, Directory}
55+
target in {CodeModel, Target, Cache, CMakeFiles, CodeModelDirectory}
5556
and "jsonFile" in data
5657
and data["jsonFile"] is not None
5758
):
59+
# Transform CodeModelDirectory to Directory object
60+
# TODO: inherit the fields from CodeModel counterparts
61+
if target is CodeModelDirectory:
62+
target = Directory # type: ignore[assignment]
5863
return self._load_from_json(Path(data["jsonFile"]), target)
5964

6065
input_dict: Dict[str, Type[Any]] = {}

0 commit comments

Comments
 (0)