File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 99from importlib .util import module_from_spec , spec_from_file_location
1010from pathlib import Path
1111
12+ from runtime_introspect import runtime_feature_set
13+
1214if sys .version_info >= (3 , 11 ):
1315 import tomllib
1416else :
@@ -157,8 +159,14 @@ def get_limited_api_option(srcdir):
157159
158160 py_limited_api = os .environ .get ("EXTENSION_HELPERS_PY_LIMITED_API" )
159161
160- if py_limited_api is not None :
162+ if py_limited_api == "auto" :
163+ fs = runtime_feature_set ()
164+ if fs .supports ("py-limited-api" ):
165+ py_limited_api = f"cp{ sys .version_info .major } { sys .version_info .minor } "
166+ else :
167+ py_limited_api = None
161168
169+ if py_limited_api is not None :
162170 if "DIST_EXTRA_CONFIG" in os .environ :
163171 raise ValueError (
164172 "Cannot use EXTENSION_HELPERS_PY_LIMITED_API if DIST_EXTRA_CONFIG is already defined"
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ classifiers = [
1818]
1919requires-python = " >=3.10"
2020dependencies = [
21+ " runtime-introspect>=0.2.0" ,
2122 " setuptools>=64" ,
2223 " tomli>=1.0.0 ; python_version < '3.11'" ,
2324]
You can’t perform that action at this time.
0 commit comments