File python-swiftclient.spec of Package python-swiftclient

#
# spec file for package python-swiftclient
#
# 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 swiftclient
%define version_unconverted 2.3.1

Name:           python-%{component}
Version:        2.3.1
Release:        0
Summary:        Openstack Object Storage (Swift) API Client
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            http://launchpad.net/python-swiftclient
Source:         https://pypi.python.org/packages/source/p/python-swiftclient/python-swiftclient-%{version}.tar.gz
Source99:       %name-rpmlintrc
Patch0:         0001-Check-that-content_type-header-exists-before-using.patch
Patch1:         0001-Do-not-crash-with-swift-list-lh-for-Ceph-RadosGW.patch
Patch2:         0001-Make-swift-post-output-an-error-message-when-failing.patch
Patch3:         0001-Fix-misnamed-variable-in-SwiftReader.patch
BuildRequires:  openstack-suse-macros
BuildRequires:  python
BuildRequires:  python-pbr
BuildRequires:  python-requests
BuildRequires:  python-setuptools
BuildRequires:  python-six
# Packages below are only needed for documentation build
BuildRequires:  python-Sphinx
BuildRequires:  python-oslosphinx
Requires:       python >= 2.6.8
Requires:       python-futures >= 2.1.3
Requires:       python-requests >= 1.1
Requires:       python-simplejson >= 2.0.9
Requires:       python-setuptools
Requires:       python-six >= 1.5.2
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()")}
%py_requires
%else
BuildArch:      noarch
%endif

%description
This is a python client for the Swift API. There's a Python API (the
swiftclient module), and a command-line script (swift).

This code is based on original the client previously included with
OpenStack's swift.

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

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

%package test
Summary:        Openstack Object Storage (Swift) API Client - Testsuite
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       python-discover
Requires:       python-keystoneclient >= 0.7
Requires:       python-mock >= 1
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 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%openstack_cleanup_prep

%build
python setup.py build
python setup.py build_sphinx
rm doc/build/html/.buildinfo

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

install -d %{buildroot}%{_mandir}/man1
install -m 644 doc/manpages/swift.1 %{buildroot}%{_mandir}/man1

# test package
%openstack_test_package_install

%files
%defattr(-,root,root,-)
%doc LICENSE README.rst
%{_bindir}/swift
%{python_sitelib}/%{component}/
%{python_sitelib}/python_%{component}-*.egg-info
%{_mandir}/man1/swift.1*

%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