From 436a4545800f697cef96d8f2f08cf33573efa696 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 4 Jan 2022 11:45:23 -0800 Subject: [PATCH] Remove python-imaging build requirements for RHEL (#1935839) Run unit tests during build Signed-off-by: Michel Alexandre Salim --- python-qrcode.spec | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/python-qrcode.spec b/python-qrcode.spec index 0b628f5..952ebd0 100644 --- a/python-qrcode.spec +++ b/python-qrcode.spec @@ -12,8 +12,11 @@ BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools -BuildRequires: python3-imaging BuildRequires: python3-six +%if ! 0%{?rhel} +# RHEL only ships qrcode-core and does not have pillow +BuildRequires: python3-imaging +%endif %global _description\ This module uses the Python Imaging Library (PIL) to allow for the\ @@ -66,18 +69,12 @@ rm -r %{buildroot}%{python3_sitelib}/%{pkgname}/tests ln -s qr %{buildroot}%{_bindir}/qrcode %check -# in lieue of a real test suite -modules=$(find qrcode -name '*.py' \ - | grep -v __init__ \ - | sort \ - | sed -e 's|/|.|g' \ - | sed -e 's|.py$||g'); - - -for m in $modules; -do - %{__python3} -c "import $m" -done +%if 0%{?rhel} +# test method requires PIL +sed -i s/test_render_pil/disabled_render_pil/g qrcode/tests/test_qrcode.py +%endif +PYTHONPATH=%{buildroot}%{python3_sitelib} \ + %{__python3} -m unittest -v qrcode.tests.test_qrcode.QRCodeTests %files -n python3-%{pkgname} %{_bindir}/qr