14
0

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
This commit is contained in:
2017-04-11 17:45:55 +00:00
committed by Git OBS Bridge
parent 1bf08f4732
commit 28a4f59c23
2 changed files with 22 additions and 26 deletions

View File

@@ -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 <sburke@cpan.org>.
%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