8ca95d9
%if 0%{?fedora}
8ca95d9
%global with_python3 1
8ca95d9
%endif
8ca95d9
8ca95d9
%{!?_licensedir: %global license %%doc}
8ca95d9
8ca95d9
%if 0%{?rhel} && 0%{?rhel} <= 6
8ca95d9
%{!?__python2:        %global __python2 /usr/bin/python2}
8ca95d9
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
8ca95d9
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
8ca95d9
%endif
8ca95d9
8ca95d9
%global modname nine
8ca95d9
8ca95d9
Name:               python-nine
8ca95d9
Version:            0.3.4
8ca95d9
Release:            2%{?dist}
8ca95d9
Summary:            Python 2 / 3 compatibility, like six, but favouring Python 3
8ca95d9
8ca95d9
License:            Public Domain
8ca95d9
URL:                http://pypi.python.org/pypi/nine
8ca95d9
Source0:            https://pypi.python.org/packages/source/n/%{modname}/%{modname}-%{version}.tar.gz
8ca95d9
BuildArch:          noarch
8ca95d9
8ca95d9
8ca95d9
BuildRequires:      python2-devel
8ca95d9
BuildRequires:      python-setuptools
8ca95d9
8ca95d9
%if 0%{?with_python3}
8ca95d9
BuildRequires:      python3-devel
8ca95d9
BuildRequires:      python3-setuptools
8ca95d9
%endif
8ca95d9
8ca95d9
%description
8ca95d9
Let's write Python 3 right now!
8ca95d9
8ca95d9
When the best Python 2/Python 3 compatibility modules -- especially the
8ca95d9
famous `*six* library invented by Benjamin Peterson
8ca95d9
<https://pypi.python.org/pypi/six>`_ -- were created, they were written
8ca95d9
from the point of view of a Python 2 programmer starting to grok Python 3.
8ca95d9
8ca95d9
When thou writeth Python, thou shalt write Python 3 and, just for a while,
8ca95d9
ensure that the thing worketh on Python 2.7 and, possibly, even 2.6.
8ca95d9
8ca95d9
Just before Python 2 is finally phased out, thine codebase shall look more
8ca95d9
like 3 than like 2.
8ca95d9
8ca95d9
nine facilitates this new point of view. You can write code that is as
8ca95d9
3ish as possible while still supporting 2.6. Very comfortable for writing
8ca95d9
new projects.
8ca95d9
8ca95d9
%if 0%{?with_python3}
8ca95d9
%package -n python3-nine
8ca95d9
Summary:            Python 2 / 3 compatibility, like six, but favouring Python 3
8ca95d9
8ca95d9
%description -n python3-nine
8ca95d9
Let's write Python 3 right now!
8ca95d9
8ca95d9
When the best Python 2/Python 3 compatibility modules -- especially the
8ca95d9
famous `*six* library invented by Benjamin Peterson
8ca95d9
<https://pypi.python.org/pypi/six>`_ -- were created, they were written
8ca95d9
from the point of view of a Python 2 programmer starting to grok Python 3.
8ca95d9
8ca95d9
When thou writeth Python, thou shalt write Python 3 and, just for a while,
8ca95d9
ensure that the thing worketh on Python 2.7 and, possibly, even 2.6.
8ca95d9
8ca95d9
Just before Python 2 is finally phased out, thine codebase shall look more
8ca95d9
like 3 than like 2.
8ca95d9
8ca95d9
nine facilitates this new point of view. You can write code that is as
8ca95d9
3ish as possible while still supporting 2.6. Very comfortable for writing
8ca95d9
new projects.
8ca95d9
%endif
8ca95d9
8ca95d9
%prep
8ca95d9
%setup -q -n %{modname}-%{version}
8ca95d9
8ca95d9
# Remove bundled egg-info in case it exists
8ca95d9
rm -rf %{modname}.egg-info
8ca95d9
%if 0%{?with_python3}
8ca95d9
rm -rf %{py3dir}
8ca95d9
cp -a . %{py3dir}
8ca95d9
%endif
8ca95d9
8ca95d9
%build
8ca95d9
%{__python2} setup.py build
8ca95d9
%if 0%{?with_python3}
8ca95d9
pushd %{py3dir}
8ca95d9
%{__python3} setup.py build
8ca95d9
popd
8ca95d9
%endif
8ca95d9
8ca95d9
%install
8ca95d9
%if 0%{?with_python3}
8ca95d9
pushd %{py3dir}
8ca95d9
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
8ca95d9
popd
8ca95d9
%endif
8ca95d9
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}
8ca95d9
8ca95d9
%check
8ca95d9
%{__python2} setup.py test
8ca95d9
%if 0%{?with_python3}
8ca95d9
pushd %{py3dir}
8ca95d9
%{__python3} setup.py test
8ca95d9
popd
8ca95d9
%endif
8ca95d9
8ca95d9
%files
8ca95d9
%doc README.rst porting.rst
8ca95d9
%license LICENSE.rst
8ca95d9
%{python2_sitelib}/%{modname}/
8ca95d9
%{python2_sitelib}/%{modname}-%{version}*
8ca95d9
8ca95d9
%if 0%{?with_python3}
8ca95d9
%files -n python3-nine
8ca95d9
%doc README.rst porting.rst
8ca95d9
%license LICENSE.rst
8ca95d9
%{python3_sitelib}/%{modname}/
8ca95d9
%{python3_sitelib}/%{modname}-%{version}*
8ca95d9
8ca95d9
%endif
8ca95d9
8ca95d9
%changelog
8ca95d9
* Sat Jan 10 2015 Ralph Bean <rbean@redhat.com> - 0.3.4-2
8ca95d9
- Declare noarch.
8ca95d9
- Remove unnecessary cflags.
8ca95d9
- Remove Group tag, as per review.
8ca95d9
8ca95d9
* Wed Jan 07 2015 Ralph Bean <rbean@redhat.com> - 0.3.4-1
8ca95d9
- initial package for Fedora