File python-redfish.spec of Package python-redfish-openstack

#
# spec file for package python-redfish
#
# Copyright (c) 2016-2020, Martin Hauke <mardnh@gmx.de>
#
# 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-%{**}}
Name:           python-redfish
Version:        0.4.4
Release:        0
Summary:        Reference implementation of Redfish standard client
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://opendev.org/x/python-redfish
Source:         https://files.pythonhosted.org/packages/source/p/python-redfish/python-redfish-%{version}.tar.gz
Patch0:         python-redfish-fix-install.patch
BuildRequires:  %{python_module Jinja2 >= 2.7.3}
BuildRequires:  %{python_module docopt >= 0.6.2}
BuildRequires:  %{python_module pbr >= 0.8}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module requests >= 2.9.1}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module simplejson >= 3.8.1}
BuildRequires:  fdupes
BuildRequires:  python-Sphinx >= 1.2.3
BuildRequires:  python-configparser
BuildRequires:  python-future
BuildRequires:  python-rpm-macros
Requires:       %{name}-common = %{version}
Requires:       python-Jinja2
Requires:       python-docopt
Requires:       python-future
Requires:       python-pbr
Requires:       python-requests
Requires:       python-simplejson
Requires:       python-tortilla
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch
%if "%{python_flavor}" == "python2"
Requires:       python-configparser
%endif
%python_subpackages

%description
python-redfish library, a reference implementation to enable Python developers
to communicate with the Redfish API
(http://www.dmtf.org/standards/redfish).

%package -n %{name}-common
Summary:        Common files for %name (python2 and python3)
Group:          Development/Languages/Python
Provides:       %{python_module redfish-common = %{version}}

%description -n %{name}-common
Common files for %name (python2 and python3).

%prep
%setup -q -n python-redfish-%{version}
%patch0 -p1

%build
%python_build
make -C doc %{?_smp_mflags} man

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/redfish-client
%python_clone -a %{buildroot}%{_bindir}/redfish-check-cartridge

mv %{buildroot}/%{_prefix}/%{_sysconfdir}/redfish-client.conf %{buildroot}/%{_sysconfdir}/redfish-client.conf
install -d -m0755 "%{buildroot}%{_mandir}/man1/"
install -m644 doc/build/man/python-redfish.1 "%{buildroot}%{_mandir}/man1/"

#%%check
# Disable tests for now since it requires a docker environment

%post
%python_install_alternative redfish-client redfish-check-cartridge

%postun
%python_uninstall_alternative redfish-client

%files %{python_files}
%license LICENSE
%doc README.rst ChangeLog AUTHORS
%doc examples/simple-*.py
%python_alternative %{_bindir}/redfish-client
%python_alternative %{_bindir}/redfish-check-cartridge
%{python_sitelib}/redfish
%{python_sitelib}/python_redfish-%{version}-py%{py_ver}.egg-info

%files -n %{name}-common
%config(noreplace) %{_sysconfdir}/redfish-client.conf
%{_datadir}/redfish-client
%{_mandir}/man1/python-redfish.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by