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