From 28a4f59c237c4c89da78ff651c83900a7a46a0925ce41741b1f77d755f2325c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Monin?= Date: Tue, 11 Apr 2017 17:45:55 +0000 Subject: [PATCH] Accepting request 486960 from home:alarrosa:branches:devel:languages:python - Use singlespec macros OBS-URL: https://build.opensuse.org/request/show/486960 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Unidecode?expand=0&rev=13 --- python-Unidecode.changes | 5 +++++ python-Unidecode.spec | 43 ++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/python-Unidecode.changes b/python-Unidecode.changes index 87b424b..e1128fb 100644 --- a/python-Unidecode.changes +++ b/python-Unidecode.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Apr 6 16:10:57 UTC 2017 - alarrosa@suse.com + +- Use singlespec macros + ------------------------------------------------------------------- Tue Jan 10 20:00:08 UTC 2017 - benoit.monin@gmx.fr diff --git a/python-Unidecode.spec b/python-Unidecode.spec index e915d09..ceb2be3 100644 --- a/python-Unidecode.spec +++ b/python-Unidecode.spec @@ -16,6 +16,7 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-Unidecode Version: 0.04.20 Release: 0 @@ -24,17 +25,15 @@ License: GPL-2.0+ Group: Development/Languages/Python Url: https://pypi.python.org/pypi/Unidecode Source: https://files.pythonhosted.org/packages/source/U/Unidecode/Unidecode-%{version}.tar.gz +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} BuildRequires: fdupes -BuildRequires: python-devel -BuildRequires: python-setuptools +BuildRequires: python-rpm-macros Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(preun): update-alternatives BuildRoot: %{_tmppath}/%{name}-%{version}-build -%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 +%python_subpackages %description It often happens that you have text data in Unicode, but you need to @@ -78,36 +77,28 @@ Sean M. Burke . %setup -q -n Unidecode-%{version} %build -python setup.py build +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} -%fdupes %buildroot/%_prefix +%python_install +%python_expand %fdupes %{buildroot}/%_prefix -# update-alternatives -mv %{buildroot}%{_bindir}/unidecode %{buildroot}%{_bindir}/unidecode-%{py_ver} -mkdir -p %{buildroot}%{_sysconfdir}/alternatives -touch %{buildroot}%{_sysconfdir}/alternatives/unidecode -ln -sf %{_sysconfdir}/alternatives/unidecode %{buildroot}%{_bindir}/unidecode +%python_clone -a %{buildroot}%{_bindir}/unidecode %check -LANG=en_US.UTF-8 python setup.py test +export LANG=en_US.UTF-8 +%python_exec setup.py test %post -update-alternatives \ - --install %{_bindir}/unidecode unidecode %{_bindir}/unidecode-%{py_ver} 20 +%python_install_alternative unidecode -%postun -if [ $1 -eq 0 ] ; then - update-alternatives --remove unidecode %{_bindir}/unidecode-%{py_ver} -fi +%preun +%python_uninstall_alternative unidecode -%files +%files %python_files %defattr(-,root,root,-) %doc LICENSE ChangeLog %{python_sitelib}/* -%ghost %{_sysconfdir}/alternatives/unidecode -%{_bindir}/unidecode -%{_bindir}/unidecode-%{py_ver} +%python_alternative %{_bindir}/unidecode %changelog