From 766b47132104bb69fe49155fe0c638dbc08ad404 Mon Sep 17 00:00:00 2001 From: anolis-bot Date: Wed, 2 Sep 2026 14:09:32 +0800 Subject: [PATCH] fix(python-asttokens): Adjust build process to avoid site-packages mismatch The build process is modified to bypass pip installation, preventing a cross-version site-packages mismatch between Python 3.11 and 3.12. The new method involves manually copying the source and creating PEP 376 dist-info. This change ensures compatibility and correct package installation. Assisted-by: qwen:qwen3.7-max --- python-asttokens.spec | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/python-asttokens.spec b/python-asttokens.spec index 78878a4..4d84232 100644 --- a/python-asttokens.spec +++ b/python-asttokens.spec @@ -51,10 +51,35 @@ sed -r -i '/pytest-cov/d' setup.cfg %build # Let setuptools_scm determine version outside of SCM export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} -pip3 wheel --no-build-isolation --no-deps . %install -pip3 install --no-build-isolation --no-deps --root %{buildroot} $(ls %{_builddir}/%{name}-%{version}/*.whl) +# Bypass pip entirely to avoid cross-version site-packages mismatch (python3.11 vs 3.12). +# pip3 (python3.11) fails import-test because six lives only under python3.12 site-packages. +# Manual install: copy source + create PEP 376 dist-info. +mkdir -p %{buildroot}%{python3_sitelib} + +# Detect package source layout (flat vs src-layout) +if [ -d src/asttokens ]; then + _srcdir=src/asttokens +elif [ -d asttokens ]; then + _srcdir=asttokens +else + echo "ERROR: Cannot find asttokens source directory" >&2 + ls -la >&2 + exit 1 +fi +cp -a "$_srcdir" %{buildroot}%{python3_sitelib}/ + +_distinfo=%{buildroot}%{python3_sitelib}/asttokens-%{version}.dist-info +mkdir -p "$_distinfo" +cat > "$_distinfo/METADATA" < "$_distinfo/INSTALLER" +touch "$_distinfo/RECORD" %if %{with check} %check @@ -62,7 +87,9 @@ pip3 install --no-build-isolation --no-deps --root %{buildroot} $(ls %{_builddir %endif -%files -n python3-asttokens -f %{pyproject_files} +%files -n python3-asttokens +/usr/lib/python3*/site-packages/asttokens/ +/usr/lib/python3*/site-packages/asttokens-%{version}.dist-info/ %doc README.rst %changelog -- Gitee