Compare commits

..

1 Commits

Author SHA1 Message Date
ae60b0a092 import RHEL 10 Beta python-qrcode-7.4.2-11.el10 2024-11-20 13:30:11 +00:00
8 changed files with 364 additions and 286 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/qrcode-5.1.tar.gz
qrcode-7.4.2.tar.gz

View File

@ -1 +0,0 @@
686d017fb655fa2f1d600b1a8672f5ee538ec2d6 SOURCES/qrcode-5.1.tar.gz

View File

@ -1,284 +0,0 @@
%global pkgname qrcode
%if 0%{?rhel} > 7
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif
Name: python-%{pkgname}
Version: 5.1
Release: 12%{?dist}
Summary: Python QR Code image generator
License: BSD
URL: https://github.com/lincolnloop/python-qrcode
Source0: http://pypi.python.org/packages/source/q/qrcode/qrcode-%{version}.tar.gz
BuildArch: noarch
%if %{with python2}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-imaging
BuildRequires: python2-six
%endif # with python2
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-imaging
BuildRequires: python3-six
%global _description\
This module uses the Python Imaging Library (PIL) to allow for the\
generation of QR Codes.\
%description %_description
%if %{with python2}
%package -n python2-%{pkgname}
Summary: %summary
Requires: python2-imaging
Requires: python2-%{pkgname}-core = %{version}-%{release}
%{?python_provide:%python_provide python2-%{pkgname}}
%description -n python2-%{pkgname} %_description
%package -n python2-%{pkgname}-core
Requires: python-six
Conflicts: python-qrcode < 5.0
Summary: Python 2 QR Code image generator (core library)
%{?python_provide:%python_provide python2-%{pkgname}-core}
%description -n python2-%{pkgname}-core
Core Python 2 module for QR code generation. Does not contain image rendering.
%endif # with python2
%package -n python3-%{pkgname}
Summary: Python QR Code image generator
Requires: python3-imaging
# For entry point:
%if 0%{?rhel} && 0%{?rhel} >= 8
Requires: platform-python-setuptools
%else
Requires: python3-setuptools
%endif
Requires: python3-%{pkgname}-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.
%package -n python3-%{pkgname}-core
Requires: python3-six
Summary: Python 3 QR Code image generator (core library)
%description -n python3-%{pkgname}-core
Core Python 3 module for QR code generation. Does not contain image rendering.
%prep
%setup -qc
%if %{with python2}
cp -a %{pkgname}-%{version} python2
# The pure plugin requires pymaging which is not packaged in Fedora.
rm python2/qrcode/image/pure.py*
# Remove shebang
sed -i '1d' python2/qrcode/console_scripts.py
%endif # with python2
cp -a %{pkgname}-%{version} python3
# The pure plugin requires pymaging which is not packaged in Fedora.
rm python3/qrcode/image/pure.py*
# Remove shebang
sed -i '1d' python3/qrcode/console_scripts.py
%build
%if %{with python2}
pushd python2
%py2_build
popd
%endif # with python2
pushd python3
%py3_build
popd
%install
%if %{with python2}
pushd python2
%py2_install
# Be sure binscripts are Python 3
rm %{buildroot}%{_bindir}/*
# Do not install tests
rm -r %{buildroot}%{python2_sitelib}/%{pkgname}/tests
popd
%endif # with python2
pushd python3
%py3_install
# Do not install tests
rm -r %{buildroot}%{python3_sitelib}/%{pkgname}/tests
popd
#
# 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
# 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');
%if %{with python2}
pushd python2
for m in $modules;
do
%{__python2} -c "import $m"
done
popd
%endif # with python2
pushd python3
for m in $modules;
do
%{__python3} -c "import $m"
done
popd
%if %{with python2}
%files -n python2-%{pkgname}
%{python2_sitelib}/%{pkgname}/image/svg.py*
%{python2_sitelib}/%{pkgname}/image/pil.py*
%files -n python2-%{pkgname}-core
%doc python2/README.rst python2/CHANGES.rst
%license python2/LICENSE
%dir %{python2_sitelib}/%{pkgname}/
%dir %{python2_sitelib}/%{pkgname}/image
%{python2_sitelib}/%{pkgname}*.egg-info
%{python2_sitelib}/%{pkgname}/*.py*
%{python2_sitelib}/%{pkgname}/image/__init__.py*
%{python2_sitelib}/%{pkgname}/image/base.py*
%endif # with python2
%files -n python3-%{pkgname}
%{_bindir}/qr
%{_bindir}/qrcode
%{_mandir}/man1/qr.1*
%{python3_sitelib}/%{pkgname}/image/svg.py*
%{python3_sitelib}/%{pkgname}/image/pil.py*
%{python3_sitelib}/%{pkgname}/image/__pycache__/svg.*
%{python3_sitelib}/%{pkgname}/image/__pycache__/pil.*
%files -n python3-%{pkgname}-core
%doc python3/README.rst python3/CHANGES.rst
%license python3/LICENSE
%dir %{python3_sitelib}/%{pkgname}/
%dir %{python3_sitelib}/%{pkgname}/image
%dir %{python3_sitelib}/%{pkgname}/image/__pycache__
%{python3_sitelib}/%{pkgname}*.egg-info
%{python3_sitelib}/%{pkgname}/*.py*
%{python3_sitelib}/%{pkgname}/__pycache__
%{python3_sitelib}/%{pkgname}/image/__init__.py*
%{python3_sitelib}/%{pkgname}/image/base.py*
%{python3_sitelib}/%{pkgname}/image/__pycache__/__init__.*
%{python3_sitelib}/%{pkgname}/image/__pycache__/base.*
%changelog
* Wed Nov 28 2018 Tomas Orsava <torsava@redhat.com> - 5.1-12
- Require platform-python-setuptools instead of python3-setuptools
- Resolves: rhbz#1654457, rhbz#1654458
* Fri Jun 22 2018 Charalampos Stratakis <cstratak@redhat.com> - 5.1-11
- Conditionalize the python2 subpackage
* Tue Mar 20 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.1-10
- Also rename python-qrcode-core to python2-qrcode-core
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.1-8
- Python 2 binary package renamed to python2-qrcode
See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 5.1-5
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Fri Jul 10 2015 Miro Hrončok <mhroncok@redhat.com> - 5.1-1
- Update to 5.1
- Introduce python3 subpackages (#1237118)
- Moved LICENSE from %%doc to %%license
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Tue Sep 16 2014 Nathaniel McCallum <npmccallum@redhat.com> - 5.0.1-2
- Make python-qrcode-core conflicts with python-qrcode < 5.0
* Wed Sep 10 2014 Nathaniel McCallum <npmccallum@redhat.com> - 5.0.1-1
- Update to 5.0.1
* Tue Sep 09 2014 Nathaniel McCallum <npmccallum@redhat.com> - 2.4.1-7
- Create -core subpackage for minimal dependencies
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Wed Jun 6 2012 Michel Salim <salimma@fedoraproject.org> - 2.4.1-2
- Clean up spec, removing unnecessary declarations
- Rename tool in %%{_bindir} to the less ambiguous qrcode
* Sat Jun 2 2012 Michel Salim <salimma@fedoraproject.org> - 2.4.1-1
- Initial package

244
python-qrcode.spec Normal file
View File

@ -0,0 +1,244 @@
## START: Set by rpmautospec
## (rpmautospec version 0.6.1)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 11;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
%global pkgname qrcode
Name: python-%{pkgname}
Version: 7.4.2
Release: %autorelease
Summary: Python QR Code image generator
License: BSD-3-Clause
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
# Make pypng requirement optional
# https://github.com/lincolnloop/python-qrcode/pull/338
Patch2: qrcode-optional-pypng.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 -x png}
%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 -v
%files -n python3-%{pkgname} -f %{pyproject_files}
%doc README.rst CHANGES.rst
%license LICENSE
%{_bindir}/qr
%{_bindir}/qrcode
%{_mandir}/man1/qr.1*
%changelog
## START: Generated by rpmautospec
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 7.4.2-11
- Bump release for June 2024 mass rebuild
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 7.4.2-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 7.4.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Aug 23 2023 Florence Blanc-Renaud <frenaud@redhat.com> - 7.4.2-8
- migrated to SPDX license
* Tue Jul 25 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 7.4.2-7
- Make pypng requirement optional
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 7.4.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Jun 16 2023 Python Maint <python-maint@redhat.com> - 7.4.2-5
- Rebuilt for Python 3.12
* Tue May 23 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 7.4.2-4
- Migrate from tox to pytest, avoid unwanted deps in RHEL builds
* Fri May 12 2023 Sandro Mani <manisandro@gmail.com> - 7.4.2-3
- Add patch to fix test failures with py3.12
* Mon May 01 2023 Sandro Mani <manisandro@gmail.com> - 7.4.2-2
- Switch to pyproject macros
* 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
- Opt in to rpmautospec
* Tue Jan 04 2022 Christian Heimes <cheimes@redhat.com> - 7.3.1-2
- Remove python-imaging build requirements for RHEL (#1935839)
- Run unit tests during build
* Thu Dec 09 2021 Sandro Mani <manisandro@gmail.com> - 7.3.1-1
- Update to 7.3.1
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 6.1-9
- Rebuilt for Python 3.10
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 6.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 6.1-6
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 6.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 6.1-4
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 6.1-3
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun May 26 2019 Fabian Affolter <mail@fabian-affolter.ch> - 6.1-1
- Update to latest upstream release 6.1
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Oct 11 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.1-14
- Python2 binary package has been removed
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 5.1-12
- Rebuilt for Python 3.7
* Fri Mar 23 2018 Iryna Shcherbina <ishcherb@redhat.com> - 5.1-11
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Tue Mar 20 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.1-10
- Also rename python-qrcode-core to python2-qrcode-core
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.1-8
- Python 2 binary package renamed to python2-qrcode
See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 5.1-5
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Fri Jul 10 2015 Miro Hrončok <mhroncok@redhat.com> - 5.1-1
- Update to 5.1
- Introduce python3 subpackages (#1237118)
- Moved LICENSE from %%doc to %%license
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Tue Sep 16 2014 Nathaniel McCallum <npmccallum@redhat.com> - 5.0.1-2
- Make python-qrcode-core conflicts with python-qrcode < 5.0
* Wed Sep 10 2014 Nathaniel McCallum <npmccallum@redhat.com> - 5.0.1-1
- Update to 5.0.1
* Tue Sep 09 2014 Nathaniel McCallum <npmccallum@redhat.com> - 2.4.1-7
- Create -core subpackage for minimal dependencies
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Wed Jun 6 2012 Michel Salim <salimma@fedoraproject.org> - 2.4.1-2
- Clean up spec, removing unnecessary declarations
- Rename tool in %%{_bindir} to the less ambiguous qrcode
* Sat Jun 2 2012 Michel Salim <salimma@fedoraproject.org> - 2.4.1-1
- Initial package
## END: Generated by rpmautospec

View File

@ -0,0 +1,93 @@
Backport of https://github.com/lincolnloop/python-qrcode/pull/338
diff --git a/qrcode/main.py b/qrcode/main.py
index 0ac91bb..53f2ab2 100644
--- a/qrcode/main.py
+++ b/qrcode/main.py
@@ -16,7 +16,6 @@ from typing_extensions import Literal
from qrcode import constants, exceptions, util
from qrcode.image.base import BaseImage
-from qrcode.image.pure import PyPNGImage
ModulesType = List[List[Optional[bool]]]
# Cache modules generated just based on the QR Code version
@@ -360,7 +359,11 @@ class QRCode(Generic[GenericImage]):
from qrcode.image.pil import Image, PilImage
# Use PIL by default if available, otherwise use PyPNG.
- image_factory = PilImage if Image else PyPNGImage
+ if Image is not None:
+ image_factory = PilImage
+ else:
+ from qrcode.image.pure import PyPNGImage
+ image_factory = PyPNGImage
im = image_factory(
self.border,
diff --git a/qrcode/tests/test_qrcode.py b/qrcode/tests/test_qrcode.py
index 5c1ea35..24c36f8 100644
--- a/qrcode/tests/test_qrcode.py
+++ b/qrcode/tests/test_qrcode.py
@@ -5,18 +5,21 @@ import warnings
from tempfile import mkdtemp
from unittest import mock
-import png
-
import qrcode
import qrcode.util
from qrcode.compat.pil import Image as pil_Image
from qrcode.exceptions import DataOverflowError
from qrcode.image.base import BaseImage
-from qrcode.image.pure import PyPNGImage
from qrcode.image.styledpil import StyledPilImage
from qrcode.image.styles import colormasks, moduledrawers
from qrcode.util import MODE_8BIT_BYTE, MODE_ALPHA_NUM, MODE_NUMBER, QRData
+try:
+ import png
+ from qrcode.image.pure import PyPNGImage
+except ImportError:
+ PyPNGImage = None
+
UNICODE_TEXT = "\u03b1\u03b2\u03b3"
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
@@ -175,6 +178,7 @@ class QRCodeTests(unittest.TestCase):
self.assertTrue(MockFactory.new_image.called)
self.assertTrue(MockFactory.drawrect.called)
+ @unittest.skipIf(not PyPNGImage, "Requires pypng")
def test_render_pypng(self):
qr = qrcode.QRCode()
qr.add_data(UNICODE_TEXT)
@@ -184,6 +188,7 @@ class QRCodeTests(unittest.TestCase):
print(img.width, img.box_size, img.border)
img.save(io.BytesIO())
+ @unittest.skipIf(not PyPNGImage, "Requires pypng")
def test_render_pypng_to_str(self):
qr = qrcode.QRCode()
qr.add_data(UNICODE_TEXT)
diff --git a/setup.cfg b/setup.cfg
index 3aff842..c17189b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -30,7 +30,6 @@ packages = find:
install_requires =
colorama;platform_system=="Windows"
typing_extensions
- pypng
python_requires = >= 3.7
[options.extras_require]
@@ -45,6 +44,8 @@ test =
pytest
pil =
pillow>=9.1.0
+png =
+ pypng
all =
zest.releaser[recommended]
tox

View File

@ -0,0 +1,9 @@
diff -rupN --no-dereference qrcode-7.4.2/qrcode/tests/test_release.py qrcode-7.4.2-new/qrcode/tests/test_release.py
--- qrcode-7.4.2/qrcode/tests/test_release.py 2023-02-05 23:11:38.000000000 +0100
+++ qrcode-7.4.2-new/qrcode/tests/test_release.py 2023-05-12 13:59:22.069372313 +0200
@@ -37,4 +37,4 @@ class UpdateManpageTests(unittest.TestCa
.replace("version", "3.11")
.replace("date", datetime.datetime.now().strftime("%-d %b %Y"))
)
- mock_file().write.has_calls([mock.call(line) for line in expected])
+ mock_file().write.assert_has_calls([mock.call(line) for line in expected if line])

16
qrcode_test.patch Normal file
View File

@ -0,0 +1,16 @@
diff -rupN --no-dereference qrcode-7.4.2/qrcode/tests/test_script.py qrcode-7.4.2-new/qrcode/tests/test_script.py
--- qrcode-7.4.2/qrcode/tests/test_script.py 2023-02-05 23:11:38.000000000 +0100
+++ qrcode-7.4.2-new/qrcode/tests/test_script.py 2023-05-12 13:59:22.053372149 +0200
@@ -59,9 +59,9 @@ class ScriptTest(unittest.TestCase):
def test_optimize(self, mock_print_ascii):
main("testtext --optimize 0".split())
- @mock.patch("sys.stdout")
- def test_factory(self, mock_stdout):
- main("testtext --factory svg".split())
+ #@mock.patch("sys.stdout")
+ #def test_factory(self, mock_stdout):
+ # main("testtext --factory svg".split())
@mock.patch("sys.stderr")
def test_bad_factory(self, mock_stderr):

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (qrcode-7.4.2.tar.gz) = a8642845990341034e39c43ef674f5b4ce8d3175a44d6062f711af2c24ffd45bda5f3ecf8a7825b7ebafe734b6396d52a37bb59177c544f921e43eaa9f1f5405