From bca5410462848f847f00337bc9eabb167785e53d61833251e2ee1e55a36b9136 Mon Sep 17 00:00:00 2001 From: Sascha Peilicke Date: Mon, 30 Sep 2013 09:00:55 +0000 Subject: [PATCH] - Implement update-alternatives - Fix testsuite run on SLE and run it only once - Properly build (and install) HTML documentation OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Babel?expand=0&rev=6 --- python-Babel.changes | 7 ++++++ python-Babel.spec | 54 ++++++++++++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/python-Babel.changes b/python-Babel.changes index 7d153ee..4e3e8f9 100644 --- a/python-Babel.changes +++ b/python-Babel.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 30 09:00:12 UTC 2013 - speilicke@suse.com + +- Implement update-alternatives +- Fix testsuite run on SLE and run it only once +- Properly build (and install) HTML documentation + ------------------------------------------------------------------- Fri Sep 27 19:59:09 UTC 2013 - dmueller@suse.com diff --git a/python-Babel.spec b/python-Babel.spec index 71d90db..ec50a95 100644 --- a/python-Babel.spec +++ b/python-Babel.spec @@ -25,49 +25,63 @@ License: BSD-3-Clause Group: Development/Languages/Python Source: http://pypi.python.org/packages/source/B/Babel/Babel-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: fdupes BuildRequires: python-devel +BuildRequires: python-setuptools +# Documentation requirements: +BuildRequires: python-Sphinx +# Test requirements: BuildRequires: python-pytest BuildRequires: python-pytz -BuildRequires: python-setuptools -%if 0%{?suse_version} -%py_requires -%if 0%{?suse_version} > 1010 -BuildRequires: fdupes -%endif -%if 0%{?suse_version} > 1110 -BuildArch: noarch -%endif -%endif Requires: python-pytz +Requires(post): update-alternatives +Requires(postun): update-alternatives Provides: python-babel = %{version} Obsoletes: python-babel < %{version} -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%if 0%{?suse_version} && 0%{?suse_version} <= 1110 +%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%else +BuildArch: noarch +%endif %description A collection of tools for internationalizing Python applications. %prep %setup -q -n Babel-%{version} -mv docs html -chmod -x babel/messages/frontend.py # Fix non-executable script +sed -i "s/pybabel =/pybabel-%{py_ver} =/" setup.py %build python setup.py build +python setup.py build_sphinx && rm build/sphinx/html/.buildinfo %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} -%if 0%{?suse_version} > 1010 -%fdupes %{buildroot}%{_prefix} -%endif +ln -s %{_bindir}/pybabel-%{py_ver} %{buildroot}%{_bindir}/pybabel +%fdupes %{buildroot}%{python_sitelib} %check -python setup.py test -py.test tests +LC_ALL=C py.test tests + +%pre +# Since /usr/bin/pybabel became ghosted to be used with update-alternatives, we have to get rid +# of the old binary resulting from the non-update-alternativies-ified package: +[[ ! -L %{_bindir}/pybabel ]] && rm -f %{_bindir}/pybabel +exit 0 + +%post +update-alternatives --install %{_bindir}/pybabel pybabel %{_bindir}/pybabel-%{py_ver} 20 + +%preun +if [ $1 -eq 0 ] ; then + update-alternatives --remove pybabel %{_bindir}/pybabel-%{py_ver} +fi %files %defattr(-,root,root,-) -%doc LICENSE CHANGES README html -%{_bindir}/pybabel +%doc LICENSE CHANGES README build/sphinx/html +%ghost %{_bindir}/pybabel +%{_bindir}/pybabel-%{py_ver} %{python_sitelib}/* %changelog