Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

%{!?_licensedir: %global license %%doc}

%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

%global modname nine

Name:               python-nine
Version:            0.3.4
Release:            2%{?dist}
Summary:            Python 2 / 3 compatibility, like six, but favouring Python 3

License:            Public Domain
URL:                http://pypi.python.org/pypi/nine
Source0:            https://pypi.python.org/packages/source/n/%{modname}/%{modname}-%{version}.tar.gz
BuildArch:          noarch


BuildRequires:      python2-devel
BuildRequires:      python-setuptools

%if 0%{?with_python3}
BuildRequires:      python3-devel
BuildRequires:      python3-setuptools
%endif

%description
Let's write Python 3 right now!

When the best Python 2/Python 3 compatibility modules -- especially the
famous `*six* library invented by Benjamin Peterson
<https://pypi.python.org/pypi/six>`_ -- were created, they were written
from the point of view of a Python 2 programmer starting to grok Python 3.

When thou writeth Python, thou shalt write Python 3 and, just for a while,
ensure that the thing worketh on Python 2.7 and, possibly, even 2.6.

Just before Python 2 is finally phased out, thine codebase shall look more
like 3 than like 2.

nine facilitates this new point of view. You can write code that is as
3ish as possible while still supporting 2.6. Very comfortable for writing
new projects.

%if 0%{?with_python3}
%package -n python3-nine
Summary:            Python 2 / 3 compatibility, like six, but favouring Python 3

%description -n python3-nine
Let's write Python 3 right now!

When the best Python 2/Python 3 compatibility modules -- especially the
famous `*six* library invented by Benjamin Peterson
<https://pypi.python.org/pypi/six>`_ -- were created, they were written
from the point of view of a Python 2 programmer starting to grok Python 3.

When thou writeth Python, thou shalt write Python 3 and, just for a while,
ensure that the thing worketh on Python 2.7 and, possibly, even 2.6.

Just before Python 2 is finally phased out, thine codebase shall look more
like 3 than like 2.

nine facilitates this new point of view. You can write code that is as
3ish as possible while still supporting 2.6. Very comfortable for writing
new projects.
%endif

%prep
%setup -q -n %{modname}-%{version}

# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{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
%{__python2} setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif

%files
%doc README.rst porting.rst
%license LICENSE.rst
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-nine
%doc README.rst porting.rst
%license LICENSE.rst
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}*

%endif

%changelog
* Sat Jan 10 2015 Ralph Bean <rbean@redhat.com> - 0.3.4-2
- Declare noarch.
- Remove unnecessary cflags.
- Remove Group tag, as per review.

* Wed Jan 07 2015 Ralph Bean <rbean@redhat.com> - 0.3.4-1
- initial package for Fedora