File python-keystoneclient.spec of Package python-keystoneclient

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


Name:           python-keystoneclient
Version:        2012.1+git.1348955975.6c127df
Release:        0
Summary:        Openstack Identity (Keystone) API Client Library
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            https://github.com/openstack/python-keystoneclient
Source:         %{name}-%{version}.tar.gz
Source2:        openstack-keystone.sh
BuildRequires:  python-devel
BuildRequires:  python-distribute
BuildRequires:  python-httplib2
Requires:       python >= 2.6.8
# /usr/bin/keystone uses pkg_resources, thus:
Requires:       python-distribute
Requires:       python-httplib2
Requires:       python-prettytable
Requires:       python-simplejson
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-keystoneclient = %{version}
Obsoletes:      openstack-keystoneclient < %{version}
Provides:       python-python-keystoneclient = %{version}
Obsoletes:      python-python-keystoneclient < %{version}

%description
This is a client for the OpenStack Keystone API. There's a Python API
(the keystoneclient module), and a command-line script (keystone). The
Keystone 2.0 API is still a moving target, so this module will remain
in "Beta" status until the API is finalized and fully implemented.

%package doc

Summary:        Openstack Identity (Keystone) API Client Library - Documentation
Group:          Documentation/HTML
BuildRequires:  python-Sphinx
Requires:       %{name} = %{version}

%description doc
This package contains documentation files for python-keystoneclient.

%package test

Summary:        Openstack Identity (Keystone) API Client Library - Testsuite
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       python-mock
Requires:       python-mox
Requires:       python-nose
Requires:       python-unittest2

%description test
The python-keystoneclient testsuite.

%prep
%setup -q
# disable intersphinx as it tries to fetch documentation via http which is not allowed during build
sed -i -e "s/,\? \?'sphinx.ext.intersphinx'//" doc/source/conf.py

%build
python setup.py build
cd doc/source && sphinx-build -b html . build/html

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
rm -rf doc/source/build/html/.doctrees doc/source/build/html/.buildinfo
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/
cp -a %{SOURCE2} %{buildroot}%{_sysconfdir}/bash_completion.d/

# test package
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}-test
cp -av tests run_tests.sh %{buildroot}%{_localstatedir}/lib/%{name}-test
ln -s %{python_sitelib}/keystoneclient %{buildroot}%{_localstatedir}/lib/%{name}-test/keystoneclient

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

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

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

%changelog
openSUSE Build Service is sponsored by