File python-glanceclient.spec of Package python-glanceclient.2398

#
# spec file for package python-glanceclient
#
# Copyright (c) 2014 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/
#


%define component glanceclient

%define version_unconverted 0.15.0

Name:           python-glanceclient
Version:        0.15.0
Release:        0
Summary:        Openstack Image (Glance) API Client
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            http://launchpad.net/python-glanceclient
Source:         https://pypi.python.org/packages/source/p/python-glanceclient/python-glanceclient-%{version}.tar.gz
Source2:        openstack-glance.sh
Source99:       %name-rpmlintrc
Patch0:         remove-deprecation-warning.patch
Patch1:         0001-Ensure-that-identity-token-in-header-is-not-an-unico.patch
# Fix bsc#964921 when python-requests >= 2.9.1
Patch2:         set_httpmessage_in_verifiedhttpsconnection.patch
Patch3:         0001-Invalid-output-running-the-command-glance-image-show.patch
BuildRequires:  openstack-suse-macros
BuildRequires:  python-base
# Documentation build requirements:
BuildRequires:  python-PrettyTable
BuildRequires:  python-Sphinx
BuildRequires:  python-iso8601
BuildRequires:  python-keystoneclient
BuildRequires:  python-oslosphinx
BuildRequires:  python-pbr
BuildRequires:  python-pyOpenSSL
BuildRequires:  python-warlock
Requires:       python >= 2.6.8
Requires:       python-Babel >= 1.3
Requires:       python-argparse
# /usr/bin/glance uses pkg_resources, thus:
Requires:       python-PrettyTable >= 0.7
Requires:       python-keystoneclient >= 0.10.0
Requires:       python-pbr >= 0.6
Requires:       python-requests >= 1.2.1
Requires:       python-six >= 1.7.0
Requires:       python-pyOpenSSL >= 0.11
Requires:       python-warlock >= 1.0.1

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%description
This is a client for the Glance which uses the OpenStack Image API. There's
a Python API (the glanceclient module), and a command-line tool (glance).

%package test
Summary:        Openstack Image (Glance) API Client - Testsuite
Group:          System/Management
Requires:       %{name} = %{version}
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
Requires:       python-discover
%endif
Requires:       python-mock >= 1.0
Requires:       python-mox3 >= 0.7.0
Requires:       python-testrepository >= 0.0.18
Requires:       python-testtools >= 0.9.34

%description test
This package contains testsuite files for %{name}.

%prep
%setup -q
%patch0
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%patch1 -p1
%endif
%patch2
%patch3 -p1
%openstack_cleanup_prep
# Our package versioning scheme is different (but we provide the correct thing) thus:
sed -i "s|python-keystoneclient>=0.1.2,<1|python-keystoneclient|" requirements.txt

%build
python setup.py build
python setup.py build_sphinx

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} --install-data=%{python_sitelib}

### bash-completion
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/bash_completion.d/openstack-glance.sh

### test subpackage
%openstack_test_package_install

%files
%defattr(-,root,root,-)
%doc LICENSE README.rst doc/build/html
%{_sysconfdir}/bash_completion.d/openstack-glance.sh
%{_bindir}/glance
%{python_sitelib}/%{component}/
%{python_sitelib}/python_%{component}-*.egg-info

%files test
%defattr(-,root,root,-)
%{_localstatedir}/lib/%{name}-test/

%changelog
openSUSE Build Service is sponsored by