python-qrcode/python-qrcode.spec

80 lines
1.8 KiB
RPMSpec
Raw Normal View History

2012-06-08 14:24:33 +00:00
%global pkgname qrcode
Name: python-%{pkgname}
2023-05-01 13:10:08 +00:00
Version: 7.4.2
Release: %autorelease
2012-06-08 14:24:33 +00:00
Summary: Python QR Code image generator
2023-08-23 17:05:49 +00:00
License: BSD-3-Clause
2012-06-08 14:24:33 +00:00
URL: https://github.com/lincolnloop/python-qrcode
2023-05-01 13:48:14 +00:00
Source0: %{pypi_source qrcode}
2012-06-08 14:24:33 +00:00
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-pytest
2023-05-01 13:48:14 +00:00
# Comment out failing test
Patch0: qrcode_test.patch
# Fix failure with Python3.12
Patch1: qrcode_assert-has-calls.patch
# Make pypng requirement optional
# https://github.com/lincolnloop/python-qrcode/pull/338
Patch2: qrcode-optional-pypng.patch
2023-05-01 13:48:14 +00:00
%description
This module uses the Python Imaging Library (PIL) to allow for the\
generation of QR Codes.
2023-05-01 13:10:08 +00:00
%package -n python3-%{pkgname}
Summary: Python QR Code image generator
2023-05-01 13:48:14 +00:00
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.
2023-05-01 13:10:08 +00:00
2023-05-01 13:48:14 +00:00
%generate_buildrequires
# RHEL does not include the extra test dependencies (coverage, pillow)
%pyproject_buildrequires %{?!rhel:-x test -x pil -x png}
2023-05-01 13:10:08 +00:00
2012-06-08 14:24:33 +00:00
%prep
%autosetup -n qrcode-%{version} -p1
# Remove shebang
sed -i '1d' qrcode/console_scripts.py
2012-06-08 14:24:33 +00:00
2023-05-01 13:10:08 +00:00
2012-06-08 14:24:33 +00:00
%build
2023-05-01 13:48:14 +00:00
%pyproject_wheel
2012-06-08 14:24:33 +00:00
2023-05-01 13:10:08 +00:00
2012-06-08 14:24:33 +00:00
%install
2023-05-01 13:48:14 +00:00
%pyproject_install
%pyproject_save_files qrcode
2012-06-08 14:24:33 +00:00
2014-09-10 20:43:02 +00:00
#
# 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
2012-06-08 14:24:33 +00:00
2023-05-01 13:48:14 +00:00
2012-06-08 14:24:33 +00:00
%check
%pytest -v
2023-05-01 13:10:08 +00:00
2023-05-01 13:48:14 +00:00
%files -n python3-%{pkgname} -f %{pyproject_files}
%doc README.rst CHANGES.rst
%license LICENSE
%{_bindir}/qr
%{_bindir}/qrcode
%{_mandir}/man1/qr.1*
2012-06-08 14:24:33 +00:00
%changelog
%autochangelog