Skip to content

Commit f5a66ee

Browse files
committed
Use an object for supported_platforms
1 parent 3ed773e commit f5a66ee

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

robotpy_build/pyproject_configs.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,23 @@ class Config:
164164
# ext_modules
165165

166166

167+
class SupportedPlatform(BaseModel):
168+
"""
169+
Supported platforms for this distribution. Currently this information is
170+
merely advisory, and is used to generate error messages when platform
171+
specific downloads fail.
172+
"""
173+
174+
class Config:
175+
extra = "forbid"
176+
177+
#: Platform operating system name
178+
os: Optional[str] = None
179+
180+
#: Platform architecture
181+
arch: Optional[str] = None
182+
183+
167184
class RobotpyBuildConfig(BaseModel):
168185
"""
169186
Main robotpy-build configuration specified in pyproject.toml
@@ -178,7 +195,7 @@ class Config:
178195
base_package: str
179196

180197
# platforms that are supported
181-
supported_platforms: List[Dict[str, str]] = [{}]
198+
supported_platforms: List[SupportedPlatform] = []
182199

183200
#
184201
# Everything below here are separate sections

robotpy_build/wrapper.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,9 @@ def _extract_zip_to(self, classifier, dst, cache):
151151
is_arch_supported = False
152152

153153
for supp_plat in self.supported_platforms:
154-
supp_os = supp_plat.get("os", None)
155-
supp_arch = supp_plat.get("arch", None)
156-
157-
if supp_os is None or supp_os == os:
154+
if supp_plat.os is None or supp_plat.os == os:
158155
is_os_supported = True
159-
if supp_arch is None or supp_arch == arch:
156+
if supp_plat.arch is None or supp_plat.arch == arch:
160157
is_arch_supported = True
161158

162159
if not (is_os_supported and is_arch_supported):

0 commit comments

Comments
 (0)