File python-quantumclient.spec of Package python-quantumclient

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

Name:           python-quantumclient
Version:        2.2.1
Release:        0
Summary:        Openstack Network (Quantum) API Client
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            http://launchpad.net/python-quantumclient
Source:         python-quantumclient-2.2.1.tar.gz
# PATCH-FEATURE-UPSTREAM add-endpoint-type-option.patch vuntz@suse.com -- Allow the HTTPClient consumer to pass endpoint_type, backported from git
Patch0:         add-endpoint-type-option.patch
BuildRequires:  openstack-suse-macros
BuildRequires:  python-base
BuildRequires:  python-distribute
# Documentation build requirements:
BuildRequires:  python-Sphinx
BuildRequires:  python-cliff >= 1.2.1
BuildRequires:  python-httplib2
BuildRequires:  python-mox
BuildRequires:  python-pyparsing >= 1.5.6
Requires:       python >= 2.6.8
Requires:       python-argparse
# /usr/bin/quantum uses pkg_resources, thus:
Requires:       python-PrettyTable >= 0.6
Requires:       python-cliff >= 1.3.1
Requires:       python-httplib2
Requires:       python-iso8601
Requires:       python-pyparsing >= 1.5.6
Requires:       python-simplejson >= 2.0.9
# because of the /usr/bin/neutron symlink
Conflicts:      python-neutronclient
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 OpenStack Quantum API. There's a Python API (the
quantumclient module), and a command-line tool (quantum).

%package test

Summary:        Openstack Network (Quantum) API Client - Testsuite
Group:          System/Management
Requires:       %{name} = %{version}
# this shouldn't be required, but it's imported by test_lib.py
Requires:       openstack-quantum
# this shouldn't be required, but we get this ImportError currently:
# from quantum.tests.unit.client_tools import stubs as client_stubs
# ImportError: No module named tests.unit.client_tools
Requires:       openstack-quantum-test
Requires:       python-cliff-tablib >= 1.0
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
Requires:       python-discover
%endif
Requires:       python-fixtures >= 0.3.12
Requires:       python-mox
Requires:       python-nose
Requires:       python-nose-exclude
Requires:       python-nosehtmloutput
Requires:       python-nosexcover
Requires:       python-openstack.nose_plugin
Requires:       python-pep8
Requires:       python-python-subunit

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

%prep
%setup -q -n python-quantumclient-2.2.1
%openstack_cleanup_prep
%patch0 -p1

%build
python setup.py build
python setup.py build_sphinx
rm -rf doc/build/html/{.buildinfo,.doctrees}

%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
ln -s quantum %{buildroot}%{_bindir}/neutron

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

### test subpackage
%openstack_test_package_install

%files
%defattr(-,root,root,-)
%doc LICENSE README doc/build/html
%{_bindir}/neutron
%{_bindir}/quantum
%{_sysconfdir}/bash_completion.d/openstack-quantum.sh
%{python_sitelib}/%{component}/
%{python_sitelib}/python_%{component}-*.egg-info
# Part of test subpackage
%exclude %{python_sitelib}/%{component}/tests/

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

%changelog
openSUSE Build Service is sponsored by