diff --git a/python-asttokens.spec b/python-asttokens.spec index 78878a46751d7fb812d8340124575ead55b7309c..4d84232d2220d773a93ac005b65e2ffcbc0fb368 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