File python-PyWebDAV3.spec of Package python-PyWebDAV3
#
# spec file for package python-PyWebDAV3
#
# Copyright (c) 2017 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/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
%bcond_without test
Name: python-PyWebDAV3
Version: 0.9.11
%define ltmsver 0.13
Release: 0
Summary: WebDAV library including a standalone server for python2 and python3
License: LGPL-2.0
Group: Development/Languages/Python
Url: https://github.com/andrewleech/PyWebDAV3
Source0: https://files.pythonhosted.org/packages/source/P/PyWebDAV3/PyWebDAV3-%{version}.tar.gz
# Only used in %check for testing purposes
Source1: http://www.webdav.org/neon/litmus/litmus-%{ltmsver}.tar.gz
# PATCH-FIX-UPSTREAM fix_python2_urllib.patch https://github.com/andrewleech/PyWebDAV3/commit/62e67e5523b6f8a3d47e1406d045c9e2abb9e8ba and https://github.com/andrewleech/PyWebDAV3/commit/eb4017d8894242ab4453cc1c2d432ebd299c13a0
Patch1: fix_python2_urllib.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with test}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module six}
%endif
Requires: python-six
BuildArch: noarch
%ifpython2
Obsoletes: %{oldpython}-PyWebDAV < %{version}
Provides: %{oldpython}-PyWebDAV = %{version}
%endif
Requires(post): update-alternatives
Requires(postun): update-alternatives
%python_subpackages
%description
WebDAV library for python2 and python3.
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 PyWebDAV3-%{version}
%patch1 -p1
%build
%python_build
%install
%python_install
%{python_expand chmod a+x %{buildroot}%{$python_sitelib}/pywebdav/server/server.py
sed -i "s|^#!/usr/bin/env python$|#!%{__$python}|" %{buildroot}%{$python_sitelib}/pywebdav/server/server.py
%fdupes %{buildroot}%{$python_sitelib}
$python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/pywebdav/server/
$python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/pywebdav/server/
%fdupes %{buildroot}%{$python_sitelib}/pywebdav/server/
}
%python_clone -a %{buildroot}%{_bindir}/davserver
%if %{with test}
%check
cp %{SOURCE1} test/
%python_expand py.test-%{$python_bin_suffix}
rm test/litmus-%{ltmsver}.tar.gz
%endif
%post
%python_install_alternative davserver
%postun
%python_uninstall_alternative davserver
%files %{python_files}
%defattr(-,root,root,-)
%doc README doc/Changes doc/LICENSE doc/TODO
%python_alternative %{_bindir}/davserver
%{python_sitelib}/*
%changelog