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