python-qrcode/python-qrcode.spec
Yaakov Selkowitz ee43108f23 Migrate from tox to pytest, avoid unwanted deps in RHEL builds
tox is unwanted in RHEL, but provides little value for even the Fedora
package.  coverage and pillow are also unwanted in RHEL, where those
tests are skipped in their absence.
2023-05-23 17:51:59 -04:00

77 lines
1.7 KiB
RPMSpec

%global pkgname qrcode
Name: python-%{pkgname}
Version: 7.4.2
Release: %autorelease
Summary: Python QR Code image generator
License: BSD
URL: https://github.com/lincolnloop/python-qrcode
Source0: %{pypi_source qrcode}
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-pytest
# Comment out failing test
Patch0: qrcode_test.patch
# Fix failure with Python3.12
Patch1: qrcode_assert-has-calls.patch
%description
This module uses the Python Imaging Library (PIL) to allow for the\
generation of QR Codes.
%package -n python3-%{pkgname}
Summary: Python QR Code image generator
Obsoletes: python3-qrcode-core < 7.4.2-2
Provides: python3-qrcode-core = %{version}-%{release}
%description -n python3-%{pkgname}
This module uses the Python Imaging Library (PIL) to allow for the
generation of QR Codes. Python 3 version.
%generate_buildrequires
# RHEL does not include the extra test dependencies (coverage, pillow)
%pyproject_buildrequires %{?!rhel:-x test -x pil}
%prep
%autosetup -n qrcode-%{version} -p1
# Remove shebang
sed -i '1d' qrcode/console_scripts.py
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files qrcode
#
# In previous iterations of the package, the qr script had been
# renamed to qrcode. This was an unnecessary change from upstream.
#
# We cary this symlink to maintain compat with old packages.
#
ln -s qr %{buildroot}%{_bindir}/qrcode
%check
%pytest
%files -n python3-%{pkgname} -f %{pyproject_files}
%doc README.rst CHANGES.rst
%license LICENSE
%{_bindir}/qr
%{_bindir}/qrcode
%{_mandir}/man1/qr.1*
%changelog
%autochangelog