diff --git a/.gitignore b/.gitignore index e69de29..8758aae 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/pypng-0.0.16.tar.gz diff --git a/python-pypng.spec b/python-pypng.spec new file mode 100644 index 0000000..9b6fd00 --- /dev/null +++ b/python-pypng.spec @@ -0,0 +1,111 @@ +%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.16 +Release: 1%{?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 +* Fri May 09 2014 Ralph Bean - 0.0.16-1 +- initial package for Fedora diff --git a/sources b/sources index e69de29..f0c8531 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +23ec36b6829c9e7dcd04f4cc535aa78c pypng-0.0.16.tar.gz