File python-vobject.spec of Package python-vobject
#
# spec file for package python-vobject
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python-vobject
Version: 0.9.2
Release: 0
Url: http://eventable.github.io/vobject/
Summary: Python package for parsing and creating iCalendar and vCard files
License: Apache-2.0
Group: Development/Languages/Python
Source: https://files.pythonhosted.org/packages/source/v/vobject/vobject-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-PyICU
BuildRequires: python-python-dateutil >= 2.4.0
BuildRequires: python-devel >= 2.7
BuildRequires: python-setuptools
BuildRequires: python-six
Requires: python-python-dateutil >= 2.4.0
Requires: python-six
Recommends: python-PyICU
Requires(post): update-alternatives
Requires(preun): update-alternatives
#replacement for vobject
Provides: vobject = %{version}
Obsoletes: vobject < 0.9.2
%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
Parses iCalendar and vCard files into Python data structures,
decoding the relevant encodings. Also serializes vobject data
structures to iCalendar, vCard, or (experimentally) hCalendar
unicode strings.
%prep
%setup -q -n vobject-%{version}
# Fix wrong-file-end-of-line-encoding
sed -i 's/\r$//' ACKNOWLEDGEMENTS.txt
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for p in change_tz ics_diff ; do
mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py_ver}
ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
done
%post
%_sbindir/update-alternatives \
--install %{_bindir}/change_tz change_tz %{_bindir}/change_tz-%{py_ver} 30 \
--slave %{_bindir}/ics_diff ics_diff %{_bindir}/ics_diff-%{py_ver}
%preun
if [ $1 -eq 0 ] ; then
%_sbindir/update-alternatives --remove change_tz %{_bindir}/change_tz-%{py_ver}
fi
%files
%defattr(-,root,root)
%doc ACKNOWLEDGEMENTS.txt LICENSE-2.0.txt README.md
%{_bindir}/change_tz
%{_bindir}/ics_diff
%{_bindir}/change_tz-%{py_ver}
%{_bindir}/ics_diff-%{py_ver}
%ghost %{_sysconfdir}/alternatives/change_tz
%ghost %{_sysconfdir}/alternatives/ics_diff
%{python_sitelib}/vobject/
%{python_sitelib}/vobject-%{version}-py*.egg-info
%changelog