File python-PyWebDAV.spec of Package python-PyWebDAV
#
# spec file for package python-pywebdav
#
# Copyright (c) 2017 SUSE LINUX Products 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-PyWebDAV
Version: 0.9.8
Release: 0
License: LGPL-2.0
Summary: WebDAV library including a standalone server for python2
Url: https://code.google.com/archive/p/pywebdav/
Group: Productivity/Networking/Web/Servers
Source: https://files.pythonhosted.org/packages/source/P/PyWebDAV/PyWebDAV-%{version}.tar.gz
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python-setuptools
Provides: python2-PyWebDAV = %{version}
BuildArch: noarch
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description
WebDAV library for python2.
Consists of a server that is ready to run Serve and the DAV package
that provides WebDAV server functionality.
Currently supports
* WebDAV level 1
* Level 2 (LOCK, UNLOCK)
* Experimental iterator support
It plays nice with
* Mac OS X Finder
* Windows Explorer
* iCal
* cadaver
* Nautilus
This package does not provide client functionality.
%prep
%setup -q -n PyWebDAV-%{version}
%build
%python2_build
%install
%python2_install
%fdupes %{buildroot}%{python2_sitelib}
chmod a+x %{buildroot}%{python2_sitelib}/pywebdav/server/server.py
sed -i "s|^#!/usr/bin/env python$|#!%{__python2}|" %{buildroot}%{python2_sitelib}/pywebdav/server/server.py
%fdupes %{buildroot}%{python2_sitelib}
python2 -m compileall -d %{python2_sitelib} %{buildroot}%{python2_sitelib}/pywebdav/server/
python2 -O -m compileall -d %{python2_sitelib} %{buildroot}%{python2_sitelib}/pywebdav/server/
%fdupes %{buildroot}%{python2_sitelib}/pywebdav/server/
mv %{buildroot}%{_bindir}/davserver %{buildroot}%{_bindir}/davserver-%{python2_bin_suffix}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/davserver %{buildroot}%{_bindir}/davserver
%post
%python2_install_alternative davserver
%postun
%python2_uninstall_alternative davserver
%files
%defattr(-,root,root)
%doc README doc/Changes doc/LICENSE doc/TODO
%python2_alternative %{_bindir}/davserver
%{python2_sitelib}/*