- 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
This commit is contained in:
Sascha Peilicke 2013-09-30 09:00:55 +00:00 committed by Git OBS Bridge
parent a97ad04b81
commit bca5410462
2 changed files with 41 additions and 20 deletions

View File

@ -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

View File

@ -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