Skip to content

Commit f47ced8

Browse files
bonzinidcbaker
authored andcommitted
cargo: typing: describe which entries can be inherited from a workspace
Signed-off-by: Paolo Bonzini <[email protected]>
1 parent b13d2d2 commit f47ced8

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

mesonbuild/cargo/raw.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ class FromWorkspace(TypedDict):
2323
'Package',
2424
{
2525
'name': Required[str],
26-
'version': Required[str],
27-
'authors': T.List[str],
28-
'edition': EDITION,
29-
'rust-version': str,
30-
'description': str,
31-
'readme': str,
32-
'license': str,
33-
'license-file': str,
34-
'keywords': T.List[str],
35-
'categories': T.List[str],
36-
'homepage': str,
37-
'repository': str,
38-
'documentation': str,
26+
'version': Required[T.Union[FromWorkspace, str]],
27+
'authors': T.Union[FromWorkspace, T.List[str]],
28+
'edition': T.Union[FromWorkspace, EDITION],
29+
'rust-version': T.Union[FromWorkspace, str],
30+
'description': T.Union[FromWorkspace, str],
31+
'readme': T.Union[FromWorkspace, str],
32+
'license': T.Union[FromWorkspace, str],
33+
'license-file': T.Union[FromWorkspace, str],
34+
'keywords': T.Union[FromWorkspace, T.List[str]],
35+
'categories': T.Union[FromWorkspace, T.List[str]],
36+
'homepage': T.Union[FromWorkspace, str],
37+
'repository': T.Union[FromWorkspace, str],
38+
'documentation': T.Union[FromWorkspace, str],
3939
'workspace': str,
4040
'build': str,
4141
'links': str,
42-
'include': T.List[str],
43-
'exclude': T.List[str],
44-
'publish': bool,
42+
'include': T.Union[FromWorkspace, T.List[str]],
43+
'exclude': T.Union[FromWorkspace, T.List[str]],
44+
'publish': T.Union[FromWorkspace, bool],
4545
'metadata': T.Dict[str, T.Dict[str, str]],
4646
'default-run': str,
4747
'autolib': bool,
@@ -117,7 +117,7 @@ class Target(TypedDict):
117117

118118
"""Target entry in the Manifest File."""
119119

120-
dependencies: T.Dict[str, DependencyV]
120+
dependencies: T.Dict[str, T.Union[FromWorkspace, DependencyV]]
121121

122122

123123
class Workspace(TypedDict):
@@ -142,9 +142,9 @@ class Workspace(TypedDict):
142142
{
143143
'package': Required[Package],
144144
'badges': T.Dict[str, Badge],
145-
'dependencies': T.Dict[str, DependencyV],
146-
'dev-dependencies': T.Dict[str, DependencyV],
147-
'build-dependencies': T.Dict[str, DependencyV],
145+
'dependencies': T.Dict[str, T.Union[FromWorkspace, DependencyV]],
146+
'dev-dependencies': T.Dict[str, T.Union[FromWorkspace, DependencyV]],
147+
'build-dependencies': T.Dict[str, T.Union[FromWorkspace, DependencyV]],
148148
'lib': LibTarget,
149149
'bin': T.List[BuildTarget],
150150
'test': T.List[BuildTarget],
@@ -162,7 +162,7 @@ class Workspace(TypedDict):
162162
"""The Cargo Manifest format."""
163163

164164

165-
class VirtualManifest(TypedDict):
165+
class VirtualManifest(TypedDict, total=False):
166166

167167
"""The Representation of a virtual manifest.
168168

0 commit comments

Comments
 (0)