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:            14%{?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:      python2-setuptools

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

%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires:      python-importlib
%endif

%global _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.

%description %_description

%package -n python2-nine
Summary: %summary
%if 0%{?rhel} && 0%{?rhel} <= 6
Requires:           python-importlib
%endif
%{?python_provide:%python_provide python2-nine}

%description -n python2-nine %_description

%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 -n python2-nine
%doc README.rst porting.rst
%{!?_licensedir:%global license %%doc}
%license LICENSE.rst
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{modname}-%{version}*

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

%endif

%changelog
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.3.4-14
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sun Dec 17 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.3.4-12
- Python 2 binary package renamed to python2-nine
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.3.4-9
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.4-8
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.4-6
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Jan 12 2015 Ralph Bean <rbean@redhat.com> - 0.3.4-4
- Specify license macro for el6.

* Mon Jan 12 2015 Ralph Bean <rbean@redhat.com> - 0.3.4-3
- Require python-importlib on el6.

* 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