ha(packaging): musllinux-wheel для HA OS и статический C++-рантайм

- _corebuild.musl_platform_tag(): на musl (Alpine/HA OS) bdist_wheel
  выпускает py3-none-musllinux_X_Y_<arch> вместо linux_<arch> — иначе pip
  ставит glibc-сборку и dlopen падает на ld-linux-x86-64.so.2
- shared-библиотека линкуется со -static-libstdc++ -static-libgcc (gcc):
  NEEDED только libm/libc (проверено readelf), меньше зависимостей у HA OS
- Gitea Actions: job build-musllinux (container python:3.12-alpine) собирает
  и публикует musl-wheel; build-glibc — как раньше; общий
  scripts/publish-gitea-pypi.sh с пропуском уже загруженных файлов
- тесты musl_platform_tag; RELEASE_HA §1.1-1.4 (выбор wheel, переустановка
  на HA OS, ручная сборка musllinux без container:); README troubleshooting
This commit is contained in:
2026-09-29 16:20:21 +03:00
parent 49d5533cd1
commit f9d917c66d
8 changed files with 270 additions and 58 deletions
+17 -7
View File
@@ -14,15 +14,18 @@ except ImportError: # setuptools < 70
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
ROOT = Path(__file__).resolve().parent
_COREBUILD = None
def _load_corebuild():
spec = spec_from_file_location(
"_pyfglair_corebuild", ROOT / "pyfglair" / "_corebuild.py"
)
module = module_from_spec(spec)
spec.loader.exec_module(module)
return module
global _COREBUILD
if _COREBUILD is None:
spec = spec_from_file_location(
"_pyfglair_corebuild", ROOT / "pyfglair" / "_corebuild.py"
)
_COREBUILD = module_from_spec(spec)
spec.loader.exec_module(_COREBUILD)
return _COREBUILD
class build_py(_build_py):
@@ -46,10 +49,17 @@ class BinaryDistribution(Distribution):
class bdist_wheel(_bdist_wheel):
"""Тег py3-none-<plat>: .so собран в ABI-режиме cffi (не CPython-ABI)."""
"""Тег py3-none-<plat>: .so собран в ABI-режиме cffi (не CPython-ABI).
На musl (Alpine/HA OS) платформа заменяется на musllinux_X_Y_<arch>,
иначе pip поставит glibc-сборку и dlopen упадёт.
"""
def get_tag(self):
_, _, platform = super().get_tag()
musl = _load_corebuild().musl_platform_tag()
if musl is not None and platform.startswith("linux_"):
platform = musl
return "py3", "none", platform