From 4f16920edb60f56459704cf268479286eb5fdd05 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Jun 15 2023 17:03:54 +0000 Subject: [PATCH 1/9] CI: Adjust a couple of specs to allow Python 3.11 builds on RHEL 9 This allows running CI tests as: ./mocktest.sh python-isort --define 'python3_pkgversion 3.11' Which only makes sense in RHEL, and hence is not done here. The purpose of this change in Fedora is to make the test spec files identical to c9s, for easier future synchronization. Related c9s commit: https://gitlab.com/redhat/centos-stream/rpms/pyproject-rpm-macros/-/commit/e8933acb121b684c6972ab0b59ac78da9cf542ed --- diff --git a/tests/python-isort.spec b/tests/python-isort.spec index 069e3d3..cde9156 100644 --- a/tests/python-isort.spec +++ b/tests/python-isort.spec @@ -9,7 +9,7 @@ License: MIT URL: https://github.com/timothycrosley/%{modname} Source0: %{url}/archive/%{version}-2/%{modname}-%{version}-2.tar.gz BuildArch: noarch -BuildRequires: python3-devel +BuildRequires: python%{python3_pkgversion}-devel BuildRequires: pyproject-rpm-macros %description @@ -17,10 +17,13 @@ This package contains executables. Building this tests that executables are not listed when +auto is not used with %%pyproject_save_files. -%package -n python3-%{modname} +This package also uses %%{python3_pkgversion} in name and has a very limited +set of dependencies -- allows to set a different value for it in the CI. + +%package -n python%{python3_pkgversion}-%{modname} Summary: %{summary} -%description -n python3-%{modname} +%description -n python%{python3_pkgversion}-%{modname} %{summary}. @@ -50,7 +53,7 @@ test -d %{buildroot}%{python3_sitelib}/%{modname}-%{version}.dist-info/ grep -F %{_bindir}/%{modname} %{pyproject_files} && exit 1 || true -%files -n python3-%{modname} -f %{pyproject_files} +%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files} %doc README.rst *.md %license LICENSE %{_bindir}/%{modname} diff --git a/tests/python-mistune.spec b/tests/python-mistune.spec index a187c7c..dfbf26f 100644 --- a/tests/python-mistune.spec +++ b/tests/python-mistune.spec @@ -8,11 +8,11 @@ URL: https://github.com/lepture/mistune Source0: %{url}/archive/v%{version}.tar.gz BuildRequires: gcc -BuildRequires: python3-devel +BuildRequires: python%{python3_pkgversion}-devel BuildRequires: pyproject-rpm-macros # optional dependency, listed explicitly to have the extension module: -BuildRequires: python3-Cython +BuildRequires: python%{python3_pkgversion}-Cython %description This package contains an extension module. Does not contain pyproject.toml. @@ -22,11 +22,13 @@ Building this tests: - default build backend without pyproject.toml Check %%pyproject_check_import basic functionality. +This package also uses %%{python3_pkgversion} in name and has a very limited +set of dependencies -- allows to set a different value for it in the CI. -%package -n python3-mistune +%package -n python%{python3_pkgversion}-mistune Summary: %summary -%description -n python3-mistune +%description -n python%{python3_pkgversion}-mistune %{summary} @@ -57,6 +59,6 @@ test -f %{buildroot}%{python3_sitearch}/mistune.py test -f %{buildroot}%{python3_sitearch}/mistune.cpython-*.so -%files -n python3-mistune -f %{pyproject_files} +%files -n python%{python3_pkgversion}-mistune -f %{pyproject_files} %doc README.rst %license LICENSE From 53c81f57c13c143f9eda8440e40c0dfbc2677512 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Jul 21 2023 06:47:19 +0000 Subject: [PATCH 2/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 59ff85a..c197ba5 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change Version: 1.9.0 -Release: 1%{?dist} +Release: 2%{?dist} # Macro files Source001: macros.pyproject @@ -161,6 +161,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Fri Jul 21 2023 Fedora Release Engineering - 1.9.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Wed May 31 2023 Maxwell G - 1.9.0-1 - Allow passing config_settings to the build backend. - Resolves: rhbz#2192581 From bd1022e422068600ee1d368902971e759cc3d032 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 21 2023 20:41:19 +0000 Subject: [PATCH 3/9] CI: Run mock in verbose mode to see the logs --- diff --git a/tests/mocktest.sh b/tests/mocktest.sh index 1804626..a7e3b70 100755 --- a/tests/mocktest.sh +++ b/tests/mocktest.sh @@ -59,8 +59,8 @@ rpmbuild -bs --define '_sourcedir .' ${pkgname}.spec # build the SRPM in mock res=0 -mock --isolation=simple -r $config --enablerepo="$repos" init -mock --isolation=simple -r $config --enablerepo="$repos" "$@" ~/rpmbuild/SRPMS/${pkgname}-*.src.rpm || res=$? +mock --verbose --isolation=simple -r $config --enablerepo="$repos" init +mock --verbose --isolation=simple -r $config --enablerepo="$repos" "$@" ~/rpmbuild/SRPMS/${pkgname}-*.src.rpm || res=$? # move the results to the artifacts directory, so we can examine them artifacts=${TEST_ARTIFACTS:-/tmp/artifacts} From 3a8bea86f8d43ec39af25859ffa3d330c7fb52a9 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 30 2023 19:48:33 +0000 Subject: [PATCH 4/9] CI: Make pytest build on Fedora 37 to 39 as well as EPEL 9 --- diff --git a/tests/python-pytest.spec b/tests/python-pytest.spec index a51a72d..2e48871 100644 --- a/tests/python-pytest.spec +++ b/tests/python-pytest.spec @@ -1,6 +1,6 @@ %global pypi_name pytest Name: python-%{pypi_name} -Version: 6.2.5 +Version: 7.1.3 Release: 0%{?dist} Summary: Simple powerful testing with Python License: MIT @@ -40,6 +40,8 @@ sed -E -i '/mock|nose/d' setup.cfg # internal check for our macros: insert a subprocess echo to setup.py # to ensure it's not generated as BuildRequires echo 'import os; os.system("echo if-this-is-generated-the-build-will-fail")' >> setup.py +# make this build in EPEL 9 +sed -i 's/setuptools-scm\[toml\]>=6.2.3/setuptools-scm[toml]>=5/' pyproject.toml %generate_buildrequires @@ -59,7 +61,7 @@ echo 'import os; os.system("echo if-this-is-generated-the-build-will-fail")' >> %if %{with tests} # Only run one test (which uses a test-only dependency, hypothesis) # See how to pass options trough the macro to tox, trough tox to pytest -%tox -- -- -k metafunc +%tox -- -- -k "metafunc and not test_parametrize_" -Wdefault %else %pyproject_check_import %endif From 3607591aa8f6ef8847356954713180d12c884903 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 30 2023 20:00:18 +0000 Subject: [PATCH 5/9] CI: Apply a FTBFS fix from Fedora 39 to the virtualenv spec --- diff --git a/tests/python-virtualenv.spec b/tests/python-virtualenv.spec index 0c08978..933cf84 100644 --- a/tests/python-virtualenv.spec +++ b/tests/python-virtualenv.spec @@ -35,6 +35,10 @@ sed -i -e 's/distlib<1,>=0.3.6/distlib<1,>=0.3.2/' \ -e 's/hatchling>=1.12.2/hatchling>=0.25/' \ -e 's/hatch-vcs>=0.3/hatch-vcs>=0.2.1/' \ pyproject.toml +# Hacky backport of https://src.fedoraproject.org/rpms/python-virtualenv/c/87b1f95664 +%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10 +sed -i 's/_nonwrappers/_hookimpls/' tests/conftest.py +%endif %generate_buildrequires From 9c358ccecbac8c5805c662c321bbda07031e7299 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 30 2023 20:23:25 +0000 Subject: [PATCH 6/9] CI: Update ipykernel to a version that no longer uses the imp module This still works on Fedora 37 and 38. The c9s package skips this test. --- diff --git a/tests/python-ipykernel.spec b/tests/python-ipykernel.spec index cba582e..abeceac 100644 --- a/tests/python-ipykernel.spec +++ b/tests/python-ipykernel.spec @@ -1,5 +1,5 @@ Name: python-ipykernel -Version: 5.2.1 +Version: 6.11.0 Release: 0%{?dist} Summary: IPython Kernel for Jupyter License: BSD @@ -11,6 +11,9 @@ BuildArch: noarch BuildRequires: pyproject-rpm-macros BuildRequires: python3-devel +# some of the nested modules import from this, but upstream does not declare the dependency +BuildRequires: python3-ipyparallel + %description This package contains data files. Building this tests that data files are not listed when +auto is not used @@ -31,11 +34,9 @@ Summary: %{summary} %prep %autosetup -p1 -n ipykernel-%{version} -# Add dependency on IPython genutils -# https://github.com/ipython/ipykernel/pull/756 -# Patch does not apply, so we dirty-sed it in -sed -i 's/install_requires=\[/install_requires=["ipython_genutils",/' setup.py - +# Remove the dependency on debugpy. +# See https://github.com/ipython/ipykernel/pull/767 +sed -i '/"debugpy/d' pyproject.toml setup.py %generate_buildrequires %pyproject_buildrequires -r @@ -48,7 +49,7 @@ sed -i 's/install_requires=\[/install_requires=["ipython_genutils",/' setup.py %pyproject_save_files 'ipykernel*' +auto %check -%pyproject_check_import -e '*.test*' -e 'ipykernel.gui*' -e 'ipykernel.pylab.backend_inline' +%pyproject_check_import -e '*.test*' -e 'ipykernel.gui*' -e 'ipykernel.pylab.*' -e 'ipykernel.trio*' %files -n python3-ipykernel -f %{pyproject_files} %license COPYING.md From 479a6b366900292fb2dd8cb5ce62150610adb9c9 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 30 2023 20:40:37 +0000 Subject: [PATCH 7/9] CI: Update poetry-core to workaround a weird FTBFS on Fedora 39+ This still builds on previous Fedoras and EPEL 9. --- diff --git a/tests/python-poetry-core.spec b/tests/python-poetry-core.spec index 5a5af4d..570a229 100644 --- a/tests/python-poetry-core.spec +++ b/tests/python-poetry-core.spec @@ -1,5 +1,5 @@ Name: python-poetry-core -Version: 1.0.0 +Version: 1.1.0 Release: 0%{?dist} Summary: Poetry PEP 517 Build Backend From 0ae2849f2034721416a349c0bc3b6c2e3057fbc1 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 30 2023 21:07:40 +0000 Subject: [PATCH 8/9] CI: Update setuptools to make it build with Python 3.12 This still works on Fedora 37/38. EL 9 uses a different setuptools version for tests. --- diff --git a/tests/python-setuptools.spec b/tests/python-setuptools.spec index c4ad546..688a867 100644 --- a/tests/python-setuptools.spec +++ b/tests/python-setuptools.spec @@ -1,8 +1,8 @@ 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: 65.5.1 +%if 0%{?fedora} || 0%{?rhel} >= 10 +Version: 67.7.2 %else Version: 59.6.0 %endif @@ -14,8 +14,8 @@ URL: https://pypi.python.org/pypi/setuptools Source: %{pypi_source setuptools %{version}} # Patch from Fedora proper -%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10 -Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/b61d86b9659/f/Remove-optional-or-unpackaged-test-deps.patch +%if 0%{?fedora} || 0%{?rhel} >= 10 +Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/8ae9b2a777c/f/Remove-optional-or-unpackaged-test-deps.patch %else Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/6fc093d6b3d/f/0001-Remove-optional-or-unpackaged-test-deps.patch %endif @@ -54,7 +54,7 @@ Summary: %{summary} %prep %autosetup -p1 -n setuptools-%{version} -%if 0%{?fedora} < 37 && 0%{?rhel} < 10 +%if 0%{?rhel} && 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' \ From 5ffc27bdf739b37502306bdf3defaf7004ffe7aa Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 30 2023 21:11:42 +0000 Subject: [PATCH 9/9] CI: Don't treat DeprecationWarnings in setuptools_scm's %check as errors --- diff --git a/tests/python-setuptools_scm.spec b/tests/python-setuptools_scm.spec index 4a3b3ed..394d732 100644 --- a/tests/python-setuptools_scm.spec +++ b/tests/python-setuptools_scm.spec @@ -58,7 +58,7 @@ Summary: %{summary} %check # This tox should run all the toxenvs specified via -e in %%pyproject_buildrequires # We only run some of the tests (running all of them requires network connection and is slow) -%tox -- -- -k test_version | tee toxlog +%tox -- -- -k test_version -Wdefault | tee toxlog # Internal check for our macros: Assert both toxenvs were executed. grep -E 'py%{python3_version_nodots}-test: (OK|commands succeeded)' toxlog