Skip to content

Commit 97aaa8e

Browse files
committed
Move CMakeFiles to versioned format
Signed-off-by: Cristian Le <git@lecris.dev>
1 parent 192dda5 commit 97aaa8e

2 files changed

Lines changed: 42 additions & 7 deletions

File tree

src/scikit_build_core/file_api/model/cmakefiles.py

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
"""
2+
.. seealso::
3+
- https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html#object-kind-cmakefiles
4+
"""
5+
16
import dataclasses
7+
from dataclasses import field
28
from pathlib import Path
3-
from typing import List
9+
from typing import List, Union
410

5-
from ._common import Paths
11+
from ..._compat.typing import TypeAlias
12+
from ._common import APIVersion, ObjectKind, Paths
613

7-
__all__ = ["CMakeFiles", "Input"]
14+
__all__ = ["CMakeFiles"]
815

916

1017
def __dir__() -> List[str]:
@@ -20,7 +27,36 @@ class Input:
2027

2128

2229
@dataclasses.dataclass(frozen=True)
23-
class CMakeFiles:
24-
kind: str
30+
class GlobsDependent:
31+
expression: str
32+
recurse: bool = False
33+
listDirectories: bool = False
34+
followSymlinks: bool = False
35+
relative: Union[str, None] = None
36+
paths: list[str] = field(default_factory=list)
37+
38+
39+
@dataclasses.dataclass(frozen=True)
40+
class CMakeFiles_1_0(ObjectKind):
41+
"""
42+
..versionadded:: 3.14.0
43+
"""
44+
45+
kind = "cmakeFiles"
46+
version = APIVersion(1, 0)
2547
paths: Paths
2648
inputs: List[Input]
49+
50+
51+
@dataclasses.dataclass(frozen=True)
52+
class CMakeFiles_1_1(CMakeFiles_1_0):
53+
"""
54+
..versionadded:: 3.30.0
55+
"""
56+
57+
version = APIVersion(1, 0)
58+
59+
globsDependent: List[GlobsDependent] = field(default_factory=list)
60+
61+
62+
CMakeFiles: TypeAlias = Union[CMakeFiles_1_0, CMakeFiles_1_1]

src/scikit_build_core/file_api/reply.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
)
1616
from .model._common import ObjectKind
1717
from .model.cache import Cache
18-
from .model.cmakefiles import CMakeFiles
1918
from .model.codemodel import CodeModel, Target
2019
from .model.directory import Directory
2120
from .model.index import Index
@@ -58,7 +57,7 @@ def make_class(self, data: InputDict, target: Type[T]) -> T:
5857
"""
5958
# TODO: remove this special handling once everything is registered in `ObjectKind`
6059
if (
61-
target in {CodeModel, Target, Cache, CMakeFiles, Directory}
60+
target in {CodeModel, Target, Cache, Directory}
6261
and "jsonFile" in data
6362
and data["jsonFile"] is not None
6463
):

0 commit comments

Comments
 (0)