File python-os-xenapi.spec of Package python-os-xenapi

#
# spec file for package python-os-xenapi
#
# Copyright (c) 2020 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 https://bugs.opensuse.org/
#


%define with_tests 1
%define with_doc 0
Name:           python-os-xenapi
Version:        0.3.4
Release:        0
Summary:        XenAPI library for OpenStack projects
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://launchpad.net/os-xenapi
Source0:        https://files.pythonhosted.org/packages/source/o/os-xenapi/os-xenapi-%{version}.tar.gz
BuildRequires:  openstack-macros
BuildRequires:  python3-devel
BuildRequires:  python3-eventlet
BuildRequires:  python3-oslo.concurrency
BuildRequires:  python3-oslo.i18n
BuildRequires:  python3-oslo.log
BuildRequires:  python3-oslo.utils
BuildRequires:  python3-oslotest
BuildRequires:  python3-paramiko
BuildRequires:  python3-pbr
BuildRequires:  python3-six
BuildRequires:  python3-stestr
BuildRequires:  python3-testscenarios
BuildRequires:  python3-testtools
BuildArch:      noarch

%description
XenAPI library for OpenStack projects.

%package -n python3-os-xenapi
Summary:        XenAPI library for OpenStack projects
Group:          Development/Languages/Python
Requires:       python3-Babel
Requires:       python3-eventlet
Requires:       python3-oslo.concurrency
Requires:       python3-oslo.i18n
Requires:       python3-oslo.log
Requires:       python3-oslo.utils
Requires:       python3-paramiko
Requires:       python3-pbr
Requires:       python3-six

%description -n python3-os-xenapi
XenAPI library for OpenStack projects.

%if 0%{?with_doc}
%package -n python-os-xenapi-doc
Summary:        Documentation for OpenStack log library
Group:          Development/Languages/Python
BuildRequires:  python3-Sphinx
BuildRequires:  python3-oslosphinx

%description -n python-os-xenapi-doc
Documentation for the os-xenapi module.
%endif

%prep
%autosetup -p1 -n os-xenapi-%{version}
%py_req_cleanup

%build
%{py3_build}

%if 0%{?with_doc}
# generate html docs
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}
%endif

%install
%{py3_install}

%if 0%{?with_tests}
%check
python3 -m stestr.cli run --test-path ./os_xenapi/tests --black-regex 'os_xenapi.tests.plugins.*'
%endif

%files -n python3-os-xenapi
%license LICENSE
%doc ChangeLog README.rst
%{python3_sitelib}/os_xenapi
%{python3_sitelib}/*.egg-info
%{_bindir}/xenapi_bootstrap

%if 0%{?with_doc}
%files -n python-os-xenapi-doc
%license LICENSE
%doc doc/build/html
%endif

%changelog