Skip to content

Commit 25472a5

Browse files
henryiiijcfr
authored andcommitted
refactor: place guard at the top
1 parent 802b2b4 commit 25472a5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/scikit_build_core/builder/wheel_tag.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ def compute_best(
8888
if len(pyvers_new) != 1:
8989
msg = "Unexpected py-api, must be a single cp version (e.g. cp39), not {py_api}"
9090
raise AssertionError(msg)
91+
if root_is_purelib:
92+
msg = f"Unexpected py-api, since platlib is set to false, must be Pythonless (e.g. py2.py3), not {py_api}"
93+
raise AssertionError(msg)
94+
9195
minor = int(pyvers_new[0][3:])
9296
if (
9397
sys.implementation.name == "cpython"
@@ -98,9 +102,6 @@ def compute_best(
98102
else:
99103
msg = "Ignoring py-api, not a CPython interpreter ({}) or version (3.{}) is too high"
100104
logger.debug(msg, sys.implementation.name, minor)
101-
if root_is_purelib:
102-
msg = f"Unexpected py-api, since platlib is set to false, must be Pythonless (e.g. py2.py3), not {py_api}"
103-
raise AssertionError(msg)
104105
elif all(x.startswith("py") and x[2:].isdecimal() for x in pyvers_new):
105106
pyvers = pyvers_new
106107
abi = "none"

0 commit comments

Comments
 (0)