File ceph-deploy.spec of Package ceph-deploy

#
# spec file for package ceph-deploy
#
# 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/
#
%if 0%{?fedora}
  %bcond_without unit_tests
%endif
%if 0%{?rhel}
  %bcond_with unit_tests
%endif
%if 0%{?suse_version}
  %if 0%{?is_opensuse}
    %bcond_without unit_tests    
  %else
    %bcond_with unit_tests
  %endif
%endif


%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

Name:           ceph-deploy
Version:        1.5.38+git.1499740004.c6666bf
Release:        0
Summary:        Admin and deploy tool for Ceph
License:        MIT
Group:          System/Filesystems
Url:            https://github.com/ceph/ceph-deploy
Source0:        %{name}-%{version}.tar.xz
# remoto is from git://ceph.com/remoto, see note in prep section

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  python-devel
BuildRequires:  python-mock >= 1.0b1
BuildRequires:  python-remoto >= 0.0.27
BuildRequires:  python-setuptools
BuildRequires:  python-argparse
%if 0%{with unit_tests}
BuildRequires:  python-tox >= 1.2
BuildRequires:  python-virtualenv
BuildRequires:  python-pip
BuildRequires:  python-flake8
%if 0%{?suse_version}
BuildRequires:  python-pytest >= 2.1.3
%else
BuildRequires:  pytest
%endif
%endif
Requires:       python-argparse
Requires:       python-remoto >= 0.0.27
Requires:	    python-setuptools

%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
%if 0%{?suse_version}
%if 0%{?suse_version} > 1210
Requires:       gptfdisk
%else
Requires:       scsirastools
%endif
%else
Requires:       gdisk
%endif

%description
An easy to use admin tool for deploy ceph storage clusters.

%prep
%setup -q

# setup.py normally pulls down the remoto source using git.
# Pre-populate the directory so that this step is avoided.
%setup -q -T -D -n %{name}-%{version}

%build
# force no new version of remoto
CEPH_DEPLOY_NO_VENDOR=no python setup.py build

%install
# force no new version of remoto
CEPH_DEPLOY_NO_VENDOR=no python setup.py install --prefix=%{_prefix} --root=%{buildroot}
install -m 0755 -D scripts/ceph-deploy %{buildroot}%{_bindir}

%check
%if 0%{with unit_tests}
# Call the unit tests directly as OBS blocks internet connection for builds
# python setup.py test
py.test ceph_deploy/tests/test_gather_keys*.py
py.test ceph_deploy/tests/test_install.py
py.test ceph_deploy/tests/test_keys_equivalent.py
py.test ceph_deploy/tests/test_mon.py
py.test ceph_deploy/tests/test_remotes.py
py.test ceph_deploy/tests/unit/
CEPH_DEPLOY_NO_VENDOR=no flake8 --select=F,E9 ceph_deploy
%endif

%files
%defattr(-,root,root,-)
%doc LICENSE README.rst
%{_bindir}/ceph-deploy
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by