Fix CI tests for setuptools 61+

Related: rhbz#2117571
This commit is contained in:
Miro Hrončok 2022-07-14 21:50:38 +00:00
parent 589556411f
commit 9899e0fa03
3 changed files with 28 additions and 2 deletions

View File

@ -48,7 +48,11 @@ cd ..
# Internal check for the value of %%{pyproject_build_lib}
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 10
cd markupsafe-%{markupsafe_version}
%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10
test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/markupsafe-%{markupsafe_version}/build/lib.%{python3_platform}-cpython-%{python3_version_nodots}"
%else
test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/markupsafe-%{markupsafe_version}/build/lib.%{python3_platform}-%{python3_version}"
%endif
cd ../tldr-%{tldr_version}
test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/tldr-%{tldr_version}/build/lib"
cd ..

View File

@ -92,7 +92,11 @@ grep -E '/site-packages/__pycache__/$' %{pyproject_files} && exit 1 || true
# Internal check for the value of %%{pyproject_build_lib} in an archful package
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 10
%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10
test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/build/lib.%{python3_platform}-cpython-%{python3_version_nodots}"
%else
test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/build/lib.%{python3_platform}-%{python3_version}"
%endif
%else
test "%{pyproject_build_lib}" == "$(echo %{_pyproject_builddir}/pip-req-build-*/build/lib.%{python3_platform}-%{python3_version})"
%endif

View File

@ -1,11 +1,22 @@
Name: python-setuptools
# on the CI we test different version of setuptools on different Fedora versions
# don't package software like this in Fedora please
%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10
Version: 62.6.0
%else
Version: 57.0.0
%endif
Release: 0%{?dist}
Summary: Easily build and distribute Python packages
# see the real Fedora package for explanation:
License: MIT and (BSD or ASL 2.0)
URL: https://pypi.python.org/pypi/setuptools
Source0: %{pypi_source setuptools %{version}}
Source: %{pypi_source setuptools %{version}}
%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10
# Patch from Fedora proper
Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/ebda604314b/f/Remove-optional-or-unpackaged-test-deps.patch
%endif
BuildArch: noarch
@ -41,6 +52,7 @@ Summary: %{summary}
%prep
%autosetup -p1 -n setuptools-%{version}
%if 0%{?fedora} < 37 && 0%{?rhel} < 10
# The following test deps are optional and either not desired or not available in Fedora:
sed -Ei setup.cfg -e '/\bpytest-(checkdocs|black|cov|mypy|enabler)\b/d' \
-e '/\bflake8\b/d' \
@ -48,6 +60,8 @@ sed -Ei setup.cfg -e '/\bpytest-(checkdocs|black|cov|mypy|enabler)\b/d' \
# Strip pytest options from the above
sed -i pytest.ini -e 's/ --flake8//' \
-e 's/ --cov//'
%endif
%generate_buildrequires
@ -73,7 +87,11 @@ rm pyproject.toml
%if %{with tests}
# We only run a subset of tests to speed things up and be less fragile
PYTHONPATH=$(pwd) %pytest --ignore=pavement.py -k "sdist"
PRE_BUILT_SETUPTOOLS_WHEEL=%{_pyproject_wheeldir}/setuptools-%{version}-py3-none-any.whl \
PYTHONPATH=$(pwd) %pytest --ignore=pavement.py \
--ignore=setuptools/tests/test_develop.py \
--ignore=setuptools/tests/config/test_apply_pyprojecttoml.py \
-k "sdist" -n %{_smp_build_ncpus}
%else
%pyproject_check_import
%endif