File python-ZODB.spec of Package python-ZODB

#
# spec file for package python-ZODB
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2013 LISA GmbH, Bingen, 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-%{**}}
%bcond_without  test
Name:           python-ZODB
Version:        5.2.4
Release:        0
Summary:        Zope Object Database: object database and persistence
License:        ZPL-2.1
Group:          Development/Libraries/Python
Url:            http://www.zodb.org/
Source:         https://files.pythonhosted.org/packages/source/Z/ZODB/ZODB-%{version}.tar.gz
BuildRequires:  %{python_module BTrees}
BuildRequires:  %{python_module ZConfig}
BuildRequires:  %{python_module persistent-devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module six}
BuildRequires:  %{python_module transaction}
BuildRequires:  %{python_module zc.lockfile}
BuildRequires:  %{python_module zdaemon >= 4.0.0}
BuildRequires:  %{python_module zope.interface}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
%if %{with test}
BuildRequires:  %{python_module manuel}
BuildRequires:  %{python_module zodbpickle >= 0.6.0}
BuildRequires:  %{python_module zope.testing}
%endif
Requires:       python-BTrees
Requires:       python-ZConfig
Requires:       python-persistent
Requires:       python-six
Requires:       python-transaction
Requires:       python-zc.lockfile
Requires:       python-zdaemon >= 4.0.0
Requires:       python-zope.interface
Requires(post): update-alternatives
Requires(preun): update-alternatives
BuildArch:      noarch

%python_subpackages

%description
The Zope Object Database provides an object-oriented database for Python that
provides a high-degree of transparency. Applications can take advantage of
object database features with few, if any, changes to application logic. ZODB
includes features such as a plugable storage interface, rich transaction
support, and undo.

%package     -n %{name}-doc
Summary:        Zope Object Database: object database and persistence
Group:          Development/Libraries/Python
Provides:       %{python_module ZODB-doc = %{version}}

%description -n %{name}-doc
This package contains documentation files for %{name}.

%prep
%setup -q -n ZODB-%{version}
# delete backup files
find . -name "*~" -print -delete
# remove unwanted shebang
find src -name "*.py" | xargs sed -i '1 { /^#!/ d }'
rm -rf src/ZODB.egg-info

%build
%python_build

%install
%python_install
%python_expand %fdupes -s %{buildroot}%{$python_sitelib}

%python_clone -a %{buildroot}%{_bindir}/fsdump
%python_clone -a %{buildroot}%{_bindir}/fsoids
%python_clone -a %{buildroot}%{_bindir}/fsrefs
%python_clone -a %{buildroot}%{_bindir}/fstail
%python_clone -a %{buildroot}%{_bindir}/repozo

%if %{with test}
%check
%python_expand rm -f base.fs* && $python setup.py test
%endif

%post
%python_install_alternative fsdump fsoids fsrefs fstail repozo

%postun
%python_uninstall_alternative fsdump

%files %{python_files}
%defattr(-,root,root)
%doc 3.11.txt CHANGES.rst COPYRIGHT.txt HISTORY.rst LICENSE.txt README.rst
%{python_sitelib}/ZODB/
%{python_sitelib}/ZODB-%{version}-py*.egg-info
%python_alternative %{_bindir}/fsdump
%python_alternative %{_bindir}/fsoids
%python_alternative %{_bindir}/fsrefs
%python_alternative %{_bindir}/fstail
%python_alternative %{_bindir}/repozo

%files -n %{name}-doc
%defattr(-,root,root,-)
%doc doc/

%changelog