Update to 7.4.2

This commit is contained in:
Sandro Mani 2023-05-01 15:10:08 +02:00
parent a70af2d5f6
commit 928d74e7e3
5 changed files with 25 additions and 195 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/qrcode-5.1.tar.gz /qrcode-5.1.tar.gz
/qrcode-6.1.tar.gz /qrcode-6.1.tar.gz
/qrcode-7.3.1.tar.gz /qrcode-7.3.1.tar.gz
/qrcode-7.4.2.tar.gz

View File

@ -1,3 +1,6 @@
* Mon May 01 2023 Sandro Mani <manisandro@gmail.com> - 7.4.2-1
- Update to 7.4.2
* Tue Jan 04 2022 Michel Alexandre Salim <salimma@fedoraproject.org> - 7.3.1-3 * Tue Jan 04 2022 Michel Alexandre Salim <salimma@fedoraproject.org> - 7.3.1-3
- Opt in to rpmautospec - Opt in to rpmautospec

View File

@ -1,23 +1,23 @@
%global pkgname qrcode %global pkgname qrcode
Name: python-%{pkgname} Name: python-%{pkgname}
Version: 7.3.1 Version: 7.4.2
Release: %autorelease Release: %autorelease
Summary: Python QR Code image generator Summary: Python QR Code image generator
License: BSD License: BSD
URL: https://github.com/lincolnloop/python-qrcode URL: https://github.com/lincolnloop/python-qrcode
Source0: https://pypi.python.org/packages/source/q/qrcode/qrcode-%{version}.tar.gz Source0: https://pypi.python.org/packages/source/q/qrcode/qrcode-%{version}.tar.gz
# skip all PIL-dependent tests on RHEL
Patch0: qrcode-7.3.1-image-tests.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-pypng
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: python3-six BuildRequires: python3-six
BuildRequires: python3-typing-extensions
%if ! 0%{?rhel} %if ! 0%{?rhel}
# RHEL only ships qrcode-core and does not have pillow # RHEL only ships qrcode-core and does not have pillow
BuildRequires: python3-imaging BuildRequires: python3-pillow
%endif %endif
%global _description\ %global _description\
@ -26,6 +26,7 @@ generation of QR Codes.
%description %_description %description %_description
%package -n python3-%{pkgname} %package -n python3-%{pkgname}
Summary: Python QR Code image generator Summary: Python QR Code image generator
Requires: python3-imaging Requires: python3-imaging
@ -37,6 +38,7 @@ Requires: python3-%{pkgname}-core = %{version}-%{release}
This module uses the Python Imaging Library (PIL) to allow for the This module uses the Python Imaging Library (PIL) to allow for the
generation of QR Codes. Python 3 version. generation of QR Codes. Python 3 version.
%package -n python3-%{pkgname}-core %package -n python3-%{pkgname}-core
Requires: python3-six Requires: python3-six
Summary: Python 3 QR Code image generator (core library) Summary: Python 3 QR Code image generator (core library)
@ -44,18 +46,17 @@ Summary: Python 3 QR Code image generator (core library)
%description -n python3-%{pkgname}-core %description -n python3-%{pkgname}-core
Core Python 3 module for QR code generation. Does not contain image rendering. Core Python 3 module for QR code generation. Does not contain image rendering.
%prep %prep
%autosetup -n qrcode-%{version} -p1 %autosetup -n qrcode-%{version} -p1
# The pure plugin requires pymaging which is not packaged in Fedora.
rm qrcode/image/pure.py*
# Remove shebang # Remove shebang
sed -i '1d' qrcode/console_scripts.py sed -i '1d' qrcode/console_scripts.py
%build %build
%py3_build %py3_build
%install %install
%py3_install %py3_install
@ -74,26 +75,37 @@ ln -s qr %{buildroot}%{_bindir}/qrcode
PYTHONPATH=%{buildroot}%{python3_sitelib} \ PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{__python3} -m unittest -v qrcode.tests.test_qrcode.QRCodeTests %{__python3} -m unittest -v qrcode.tests.test_qrcode.QRCodeTests
%files -n python3-%{pkgname} %files -n python3-%{pkgname}
%{_bindir}/qr %{_bindir}/qr
%{_bindir}/qrcode %{_bindir}/qrcode
%{_mandir}/man1/qr.1* %{_mandir}/man1/qr.1*
%{python3_sitelib}/%{pkgname}/image/svg.py* %{python3_sitelib}/%{pkgname}/image/svg.py*
%{python3_sitelib}/%{pkgname}/image/pil.py* %{python3_sitelib}/%{pkgname}/image/pil.py*
%{python3_sitelib}/%{pkgname}/image/pure.py*
%{python3_sitelib}/%{pkgname}/image/styledpil.py* %{python3_sitelib}/%{pkgname}/image/styledpil.py*
%{python3_sitelib}/%{pkgname}/image/__pycache__/svg.* %{python3_sitelib}/%{pkgname}/image/__pycache__/svg.*
%{python3_sitelib}/%{pkgname}/image/__pycache__/pil.* %{python3_sitelib}/%{pkgname}/image/__pycache__/pil.*
%{python3_sitelib}/%{pkgname}/image/__pycache__/pure.*
%{python3_sitelib}/%{pkgname}/image/__pycache__/styledpil.* %{python3_sitelib}/%{pkgname}/image/__pycache__/styledpil.*
%files -n python3-%{pkgname}-core %files -n python3-%{pkgname}-core
%doc README.rst CHANGES.rst %doc README.rst CHANGES.rst
%license LICENSE %license LICENSE
%dir %{python3_sitelib}/%{pkgname}/ %dir %{python3_sitelib}/%{pkgname}/
%dir %{python3_sitelib}/%{pkgname}/compat
%dir %{python3_sitelib}/%{pkgname}/compat/__pycache__
%dir %{python3_sitelib}/%{pkgname}/image %dir %{python3_sitelib}/%{pkgname}/image
%dir %{python3_sitelib}/%{pkgname}/image/__pycache__ %dir %{python3_sitelib}/%{pkgname}/image/__pycache__
%{python3_sitelib}/%{pkgname}*.egg-info %{python3_sitelib}/%{pkgname}*.egg-info
%{python3_sitelib}/%{pkgname}/*.py* %{python3_sitelib}/%{pkgname}/*.py*
%{python3_sitelib}/%{pkgname}/__pycache__ %{python3_sitelib}/%{pkgname}/__pycache__
%{python3_sitelib}/%{pkgname}/compat/__init__.py*
%{python3_sitelib}/%{pkgname}/compat/etree.py*
%{python3_sitelib}/%{pkgname}/compat/pil.py*
%{python3_sitelib}/%{pkgname}/compat/__pycache__/__init__.*
%{python3_sitelib}/%{pkgname}/compat/__pycache__/etree.*
%{python3_sitelib}/%{pkgname}/compat/__pycache__/pil.*
%{python3_sitelib}/%{pkgname}/image/__init__.py* %{python3_sitelib}/%{pkgname}/image/__init__.py*
%{python3_sitelib}/%{pkgname}/image/base.py* %{python3_sitelib}/%{pkgname}/image/base.py*
%{python3_sitelib}/%{pkgname}/image/styles/ %{python3_sitelib}/%{pkgname}/image/styles/

View File

@ -1,186 +0,0 @@
diff --git a/qrcode/tests/test_qrcode.py b/qrcode/tests/test_qrcode.py
index ce9a807..9709974 100644
--- a/qrcode/tests/test_qrcode.py
+++ b/qrcode/tests/test_qrcode.py
@@ -17,9 +17,12 @@ import qrcode.image.svg
import qrcode.util
from qrcode.exceptions import DataOverflowError
from qrcode.image.base import BaseImage
-from qrcode.image.pil import Image as pil_Image
-from qrcode.image.styledpil import StyledPilImage
-from qrcode.image.styles import colormasks, moduledrawers
+try:
+ from qrcode.image.pil import Image as pil_Image
+ from qrcode.image.styledpil import StyledPilImage
+ from qrcode.image.styles import colormasks, moduledrawers
+except ImportError:
+ pil_Image = None
from qrcode.tests.svg import SvgImageWhite
from qrcode.util import MODE_8BIT_BYTE, MODE_ALPHA_NUM, MODE_NUMBER, QRData
@@ -106,6 +109,7 @@ class QRCodeTests(unittest.TestCase):
qr.make()
self.assertEqual(qr.data_list[0].mode, MODE_8BIT_BYTE)
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_pil(self):
qr = qrcode.QRCode()
qr.add_data(UNICODE_TEXT)
@@ -113,24 +117,28 @@ class QRCodeTests(unittest.TestCase):
img.save(io.BytesIO())
self.assertIsInstance(img.get_image(), pil_Image.Image)
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_pil_with_transparent_background(self):
qr = qrcode.QRCode()
qr.add_data(UNICODE_TEXT)
img = qr.make_image(back_color='TransParent')
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_pil_with_red_background(self):
qr = qrcode.QRCode()
qr.add_data(UNICODE_TEXT)
img = qr.make_image(back_color='red')
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_pil_with_rgb_color_tuples(self):
qr = qrcode.QRCode()
qr.add_data(UNICODE_TEXT)
img = qr.make_image(back_color=(255, 195, 235), fill_color=(55, 95, 35))
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_with_pattern(self):
qr = qrcode.QRCode(mask_pattern=3)
qr.add_data(UNICODE_TEXT)
@@ -230,12 +238,14 @@ class QRCodeTests(unittest.TestCase):
with self.assertRaises(ValueError):
img.save(io.BytesIO(), kind='FISH')
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_pil_image(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
img = qr.make_image(image_factory=StyledPilImage)
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_embeded_image(self):
embeded_img = pil_Image.new('RGB', (10, 10), color='red')
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
@@ -243,6 +253,7 @@ class QRCodeTests(unittest.TestCase):
img = qr.make_image(image_factory=StyledPilImage, embeded_image=embeded_img)
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_embeded_image_path(self):
tmpfile = os.path.join(self.tmpdir, "test.png")
embeded_img = pil_Image.new('RGB', (10, 10), color='red')
@@ -253,42 +264,49 @@ class QRCodeTests(unittest.TestCase):
img.save(io.BytesIO())
os.remove(tmpfile)
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_square_module_drawer(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
img = qr.make_image(image_factory=StyledPilImage, module_drawer=moduledrawers.SquareModuleDrawer())
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_gapped_module_drawer(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
img = qr.make_image(image_factory=StyledPilImage, module_drawer=moduledrawers.GappedSquareModuleDrawer())
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_circle_module_drawer(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
img = qr.make_image(image_factory=StyledPilImage, module_drawer=moduledrawers.CircleModuleDrawer())
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_rounded_module_drawer(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
img = qr.make_image(image_factory=StyledPilImage, module_drawer=moduledrawers.RoundedModuleDrawer())
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_vertical_bars_module_drawer(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
img = qr.make_image(image_factory=StyledPilImage, module_drawer=moduledrawers.VerticalBarsDrawer())
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_horizontal_bars_module_drawer(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
img = qr.make_image(image_factory=StyledPilImage, module_drawer=moduledrawers.HorizontalBarsDrawer())
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_default_solid_color_mask(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
@@ -296,6 +314,7 @@ class QRCodeTests(unittest.TestCase):
img = qr.make_image(image_factory=StyledPilImage, color_mask=mask)
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_solid_color_mask(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
@@ -303,6 +322,7 @@ class QRCodeTests(unittest.TestCase):
img = qr.make_image(image_factory=StyledPilImage, color_mask=mask)
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_color_mask_with_transparency(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
@@ -311,6 +331,7 @@ class QRCodeTests(unittest.TestCase):
img.save(io.BytesIO())
assert img.mode == "RGBA"
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_radial_gradient_color_mask(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
@@ -318,6 +339,7 @@ class QRCodeTests(unittest.TestCase):
img = qr.make_image(image_factory=StyledPilImage, color_mask=mask)
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_square_gradient_color_mask(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
@@ -325,6 +347,7 @@ class QRCodeTests(unittest.TestCase):
img = qr.make_image(image_factory=StyledPilImage, color_mask=mask)
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_horizontal_gradient_color_mask(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
@@ -332,6 +355,7 @@ class QRCodeTests(unittest.TestCase):
img = qr.make_image(image_factory=StyledPilImage, color_mask=mask)
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_vertical_gradient_color_mask(self):
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
@@ -339,6 +363,7 @@ class QRCodeTests(unittest.TestCase):
img = qr.make_image(image_factory=StyledPilImage, color_mask=mask)
img.save(io.BytesIO())
+ @unittest.skipIf(not pil_Image, "Requires PIL")
def test_render_styled_with_image_color_mask(self):
img_mask = pil_Image.new('RGB', (10, 10), color='red')
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_L)

View File

@ -1 +1 @@
SHA512 (qrcode-7.3.1.tar.gz) = 9e0e508418164926a074d8c6d85419b39a36c01ac6d92415a15ce43d4aea79fa2a8d0167982f832970d2a68ec18d2b729f09e15d80b4f4c33b992999527d39f9 SHA512 (qrcode-7.4.2.tar.gz) = a8642845990341034e39c43ef674f5b4ce8d3175a44d6062f711af2c24ffd45bda5f3ecf8a7825b7ebafe734b6396d52a37bb59177c544f921e43eaa9f1f5405