%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
%if 0%{?fedora}
%global with_python3 1
%endif
%global modname pypng
Name: python-pypng
Version: 0.0.18
Release: 7%{?dist}
Summary: Pure Python PNG image encoder/decoder
Group: Development/Libraries
License: MIT
URL: http://pypi.python.org/pypi/pypng
Source0: https://github.com/drj11/%{modname}/archive/%{modname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-nose
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-nose
BuildRequires: python-tools
%endif
%description
PyPNG allows PNG image files to be read and written using pure Python.
It's available from github.com https://github.com/drj11/pypng
Documentation is kindly hosted by PyPI http://pythonhosted.org/pypng/
%if 0%{?with_python3}
%package -n python3-pypng
Summary: Pure Python PNG image encoder/decoder
Group: Development/Libraries
%description -n python3-pypng
PyPNG allows PNG image files to be read and written using pure Python.
It's available from github.com https://github.com/drj11/pypng
Documentation is kindly hosted by PyPI http://pythonhosted.org/pypng/
%endif
%prep
%setup -q -n %{modname}-%{modname}-%{version}
# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info
# Remove the shebang from the main lib
lib=code/png.py
sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
touch -r $lib $lib.new &&
mv $lib.new $lib
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
2to3 --write --nobackups %{py3dir}
%endif
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}
%check
nosetests code/png.py
%if 0%{?with_python3}
pushd %{py3dir}
nosetests-%{python3_version} code/png.py
popd
%endif
%files
%doc README.txt LICENCE
%{python2_sitelib}/png.py*
%{python2_sitelib}/%{modname}-%{version}*
%if 0%{?with_python3}
%files -n python3-pypng
%doc README.txt LICENCE
%{python3_sitelib}/png.py*
%{python3_sitelib}/__pycache__/png*
%{python3_sitelib}/%{modname}-%{version}-*
%endif
%changelog
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.18-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.18-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 0.0.18-5
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.18-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.18-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.18-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Sat Aug 01 2015 Ralph Bean <rbean@redhat.com> - 0.0.18-1
- new version
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.17-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Tue May 12 2015 Ralph Bean <rbean@redhat.com> - 0.0.17-1
- new version
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.16-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.0.16-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
* Fri May 09 2014 Ralph Bean <rbean@redhat.com> - 0.0.16-1
- initial package for Fedora