File python-Radicale.spec of Package python-Radicale

#
# spec file for package python-Radicale
#
# Copyright (c) 2018 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/
#


%define skip_python2 1

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-Radicale
Version:        2.1.10
Release:        0
Summary:        A Simple Calendar and Contact Server
License:        GPL-3.0-only
Group:          Development/Languages/Python
Url:            http://radicale.org/
Source:         https://files.pythonhosted.org/packages/source/R/Radicale/Radicale-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module vobject}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-vobject
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch

%python_subpackages

%description
The Radicale Project is a complete CalDAV (calendar) and CardDAV (contact)
server solution.

Calendars and address books are available for both local and remote access,
possibly limited through authentication policies. They can be viewed and
edited by calendar and contact clients on mobile phones or computers.

%prep
%setup -q -n  Radicale-%{version}
chmod -x radicale.fcgi radicale.wsgi

# add file encoding
sed '2i# -*- coding: utf-8 -*-' setup.py > setup.py.new
touch -r setup.py setup.py.new
mv setup.py.new setup.py

%build
%python_build

%install
%python_install
%fdupes %{buildroot}%{_prefix}

%python_clone -a %{buildroot}%{_bindir}/radicale

%post
%python_install_alternative radicale

%postun
%python_uninstall_alternative radicale

%files %{python_files}
%defattr(-,root,root,-)
%doc config COPYING logging NEWS.md radicale.fcgi radicale.wsgi README.md
%{python_sitelib}/Radicale-%{version}-py%{python_version}.egg-info
%{python_sitelib}/radicale
%python_alternative %{_bindir}/radicale

%changelog