File python-novaclient.spec of Package python-novaclient

#
# spec file for package python-novaclient
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2011 Christian Berendt.
#
# 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-novaclient
Version:        2012.1+git.1345053935.bab694e
Release:        0
Summary:        Openstack Compute (Nova) API Client Library
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            https://github.com/openstack/python-novaclient
Source:         %{name}-%{version}.tar.gz
Source2:        openstack-nova.sh
# PATCH-FEATURE-UPSTREAM volume-list-all_tenants.patch vuntz@suse.com -- Add --all_tenants option to volume-list command, https://review.openstack.org/#/c/13708/
Patch0:         volume-list-all_tenants.patch
# PATCH-FIX-UPSTREAM encode-user-data-utf8.patch bnc#777867 vuntz@suse.com -- encode user data to UTF-8 when creating a server
Patch1:         encode-user-data-utf8.patch
BuildRequires:  python-devel
BuildRequires:  python-setuptools
Requires:       python >= 2.6.8
# /usr/bin/nova uses pkg_resources, thus:
Requires:       python-argparse
Requires:       python-httplib2
Requires:       python-prettytable >= 0.6
Requires:       python-setuptools
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-novaclient = %{version}
Obsoletes:      openstack-novaclient < %{version}
Provides:       python-python-novaclient = %{version}
Obsoletes:      python-python-novaclient < %{version}

%description
This is a client for the OpenStack Nova API. There's a Python API (the
novaclient module), and a command-line script (nova). Each implements
100% of the OpenStack Nova API.

%package test

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

%description test
The python-novaclient testsuite.

%prep
%setup -q
%patch0 -p1
%patch1 -p1

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
chmod +x %{buildroot}/%{_bindir}/nova
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}/novaclient %{buildroot}%{_localstatedir}/lib/%{name}-test/novaclient

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

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

%changelog
openSUSE Build Service is sponsored by