@@ -97,6 +97,20 @@ def _maybe_set_host_platform(config_settings: dict[str, Any] | None) -> None:
9797 ) # TODO: drop this hack/use of private API
9898
9999
100+ def _force_py3_none_tag () -> None :
101+ """Force py3-none-<platform> instead of cp<XY>-cp<XY>-<platform>.
102+
103+ With pure: false, meson-python assumes every file in {platlib} is a CPython
104+ extension module and applies a Python-version-specific ABI tag. The Hugo
105+ binary is a Go executable that runs under any Python version, so we patch
106+ _has_extension_modules to always return False, and that causes meson-python
107+ to fall through to the py3-none-<platform> branch in its tag property.
108+ TODO: drop this hack/use of public API if meson-python someday exposes a way
109+ to opt out of the CPython ABI tag for non-extension platlib content.
110+ """
111+ mesonpy ._WheelBuilder ._has_extension_modules = property (lambda _ : False )
112+
113+
100114# Unchanged meson-python PEP 517 entry points below
101115
102116
@@ -106,6 +120,7 @@ def build_wheel(
106120 metadata_directory : str | None = None ,
107121) -> str :
108122 _maybe_set_host_platform (config_settings )
123+ _force_py3_none_tag ()
109124 return mesonpy .build_wheel (wheel_directory , config_settings , metadata_directory )
110125
111126
@@ -115,6 +130,7 @@ def build_editable(
115130 metadata_directory : str | None = None ,
116131) -> str :
117132 _maybe_set_host_platform (config_settings )
133+ _force_py3_none_tag ()
118134 return mesonpy .build_editable (wheel_directory , config_settings , metadata_directory )
119135
120136
0 commit comments