File python-keystoneclient.spec of Package python-keystoneclient

#
# spec file for package python-keystoneclient
#
# 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 keystoneclient

Name:           python-%{component}
Version:        0.2.3
Release:        0
Summary:        Openstack Identity (Keystone) API Client
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            http://launchpad.net/python-keystoneclient
Source:         python-keystoneclient-0.2.3.tar.gz
Source2:        openstack-keystone.sh
Patch0:         0001-Pass-memcache_servers-as-array.patch
Patch1:         default-signing-dir-to-temp.diff
Patch2:         0001-Add-workaround-for-OSError-raised-by-Popen.communica.patch
# PATCH-FIX-OPENSUSE: speilicke@suse.com -- Backport of https://review.openstack.org/#/c/33661
Patch3:         keystoneclient-fix-memcache-enryption-middleware.patch
# PATCH-FIX-OPENSUSE: speilicke@suse.com -- Backport of https://github.com/openstack/python-keystoneclient/commit/20e166fd8a943ee3f91ba362a47e9c14c7cc5f4c
Patch4:         keystoneclient-use-requests-for-auth_token.patch
# PATCH-FIX-OPENSUSE: speilicke@suse.com -- Disable tests related to requests backport. Otherwise far to many upstream commits to backport too...
Patch5:         keystoneclient-use-requests-for-auth_token-disable-tests.patch
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-base
BuildRequires:  python-distribute
# Packages below are only needed for documentation build
BuildRequires:  python-PrettyTable
BuildRequires:  python-Sphinx >= 1.1.2
BuildRequires:  python-WebOb
BuildRequires:  python-argparse
BuildRequires:  python-iso8601 >= 0.1.4
BuildRequires:  python-requests >= 0.8.8
Requires:       python >= 2.6.8
# /usr/bin/keystone uses pkg_resources, thus:
Requires:       python-PrettyTable
Requires:       python-iso8601 >= 0.1.4
Requires:       python-netaddr
Requires:       python-oslo.config >= 1.1.0
Requires:       python-requests >= 0.8.8
Requires:       python-simplejson
Recommends:     python-keyring
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
# Provides/Obsoletes for openSUSE-12.2 package names:
Provides:       openstack-%{component} = %{version}
Obsoletes:      openstack-%{component} < %{version}
Provides:       python-python-%{component} = %{version}
Obsoletes:      python-python-%{component} < %{version}

%description
This is a client for the OpenStack Keystone API. There's a Python API
(the keystoneclient module), and a command-line tool (keystone).

%package doc
Summary:        Openstack Identity (Keystone) API Client - Documentation
Group:          Documentation/HTML
Requires:       %{name} = %{version}

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

%package test
Summary:        Openstack Identity (Keystone) API Client - Testsuite
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       python-WebOb >= 1.0.8
Requires:       python-coverage
Requires:       python-fixtures
Requires:       python-mock
Requires:       python-mox
Requires:       python-nose
Requires:       python-nose-exclude
Requires:       python-nosehtmloutput
Requires:       python-openstack.nose_plugin
Requires:       python-pep8 >= 1.3.3
Requires:       python-pycrypto
Requires:       python-testtools >= 0.9.22

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

%prep
%setup -q -n python-keystoneclient-0.2.3
%patch0 -p1
%patch1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%openstack_cleanup_prep
# Fix example PKI certs location for testsuite:
sed -i "s|python-keystoneclient/examples|python-keystoneclient-test/examples|" tests/test_auth_token_middleware.py

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

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

rm -rf doc/build/html/{.buildinfo,.doctrees}
%fdupes doc

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

### test subpackage
%openstack_test_package_install

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

%files doc
%defattr(-,root,root,-)
%doc LICENSE doc/build/html

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

%changelog
openSUSE Build Service is sponsored by