From 9899e0fa03b0c78c8a7b21b00cc1944b03d1606f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 14 Jul 2022 21:50:38 +0000 Subject: [PATCH] Fix CI tests for setuptools 61+ Related: rhbz#2117571 --- tests/double-install.spec | 4 ++++ tests/python-ldap.spec | 4 ++++ tests/python-setuptools.spec | 22 ++++++++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/double-install.spec b/tests/double-install.spec index 56eaa37..1db103f 100644 --- a/tests/double-install.spec +++ b/tests/double-install.spec @@ -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 .. diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index 41a446e..165818b 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -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 diff --git a/tests/python-setuptools.spec b/tests/python-setuptools.spec index f6b67d3..b63f8e8 100644 --- a/tests/python-setuptools.spec +++ b/tests/python-setuptools.spec @@ -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