File python-openstacksdk.spec of Package python-openstacksdk

%global pypi_name openstacksdk

%bcond_with python2
%bcond_with python3
%bcond_with test

%global common_desc \
A collection of libraries for building applications to work with OpenStack \
clouds.

%global common_desc_tests \
A collection of libraries for building applications to work with OpenStack \
clouds - test files

Name:           python-%{pypi_name}
Version:        0.17.2
Release:        1%{?dist}
Summary:        An SDK for building applications to work with OpenStack

License:        Apache-2.0
URL:            http://developer.openstack.org/sdks/python/openstacksdk/
Source0:        https://pypi.io/packages/source/o/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

%description
%{common_desc}

%if %{with python2}
%package -n python2-%{pypi_name}
Summary:        %{summary}

BuildRequires:  python2-devel

BuildConflicts: python2-jsonpatch = 1.20
BuildConflicts: python2-pbr = 2.1.0
BuildRequires:  python2-cryptography >= 2.1
BuildRequires:  python2-decorator >= 3.4.0
BuildRequires:  python2-deprecation >= 1.0
BuildRequires:  python2-dogpile-cache >= 0.6.2
BuildRequires:  python2-futures >= 3.0.0
BuildRequires:  python2-ipaddress >= 1.0.17
BuildRequires:  python2-iso8601 >= 0.1.11
BuildRequires:  python2-jmespath >= 0.9.0
BuildRequires:  python2-jsonpatch >= 1.16
BuildRequires:  python2-keystoneauth1 >= 3.8.0
BuildRequires:  python2-munch >= 2.1.0
BuildRequires:  python2-netifaces >= 0.10.4
BuildRequires:  python2-os-service-types >= 1.2.0
BuildRequires:  python2-pbr >= 2.0.0
BuildRequires:  python2-PyYAML
BuildRequires:  python2-requestsexceptions >= 1.2.0
BuildRequires:  python2-setuptools
BuildRequires:  python2-six >= 1.10.0

%if %{with test}
BuildConflicts: python2-coverage = 4.4
BuildRequires:  python2-appdirs >= 1.3.0
BuildRequires:  python2-coverage >= 4.0
BuildRequires:  python2-extras >= 1.0.0
BuildRequires:  python2-fixtures >= 3.0.0
BuildRequires:  python2-jsonschema < 3.0.0
BuildRequires:  python2-jsonschema >= 2.6.0
BuildRequires:  python2-mock >= 2.0.0
BuildRequires:  python2-oslotest >= 3.2.0
BuildRequires:  python2-python-subunit >= 1.0.0
BuildRequires:  python2-requests-mock >= 1.2.0
BuildRequires:  python2-stestr >= 1.0.0
BuildRequires:  python2-testrepository >= 0.0.18
BuildRequires:  python2-testscenarios >= 0.4
BuildRequires:  python2-testtools >= 2.2.0
%endif # with test

Conflicts:      python2-jsonpatch = 1.20
Conflicts:      python2-pbr = 2.1.0
Requires:       python2-appdirs >= 1.3.0
Requires:       python2-cryptography >= 2.1
Requires:       python2-decorator >= 3.4.0
Requires:       python2-deprecation >= 1.0
Requires:       python2-dogpile-cache >= 0.6.2
Requires:       python2-futures >= 3.0.0
Requires:       python2-ipaddress >= 1.0.17
Requires:       python2-iso8601 >= 0.1.11
Requires:       python2-jmespath >= 0.9.0
Requires:       python2-jsonpatch >= 1.16
Requires:       python2-keystoneauth1 >= 3.8.0
Requires:       python2-munch >= 2.1.0
Requires:       python2-netifaces >= 0.10.4
Requires:       python2-os-service-types >= 1.2.0
Requires:       python2-pbr >= 2.0.0
# Requires:       python2-PyYAML >= 3.11
Requires:       python2-PyYAML >= 3.12
Requires:       python2-requestsexceptions >= 1.2.0
Requires:       python2-setuptools
Requires:       python2-six >= 1.10.0

%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-%{pypi_name}
%{description}

%package -n python2-%{pypi_name}-tests
Summary:        An SDK for building applications to work with OpenStack - test files

Requires: python2-%{pypi_name} = %{version}-%{release}

%description -n python2-%{pypi_name}-tests
%{common_desc_tests}
%endif # with python2

%if %{with python3}
%package -n python%{python3_pkgversion}-%{pypi_name}
Summary:        %{summary}

BuildRequires:  python%{python3_pkgversion}-devel
BuildConflicts: python%{python3_pkgversion}-jsonpatch = 1.20
BuildConflicts: python%{python3_pkgversion}-pbr = 2.1.0
BuildRequires:  python%{python3_pkgversion}-cryptography >= 2.1
BuildRequires:  python%{python3_pkgversion}-decorator >= 3.4.0
BuildRequires:  python%{python3_pkgversion}-deprecation >= 1.0
#%if 0%{?suse_version}
#BuildRequires:  python3-dogpile.cache >= 0.6.2
#%else
BuildRequires:  python%{python3_pkgversion}-dogpile-cache >= 0.6.2
#%endif
BuildRequires:  python%{python3_pkgversion}-iso8601 >= 0.1.11
BuildRequires:  python%{python3_pkgversion}-jmespath >= 0.9.0
BuildRequires:  python%{python3_pkgversion}-jsonpatch >= 1.16
BuildRequires:  python%{python3_pkgversion}-keystoneauth1 >= 3.8.0
BuildRequires:  python%{python3_pkgversion}-munch >= 2.1.0
BuildRequires:  python%{python3_pkgversion}-netifaces >= 0.10.4
BuildRequires:  python%{python3_pkgversion}-os-service-types >= 1.2.0
BuildRequires:  python%{python3_pkgversion}-pbr >= 2.0.0
BuildRequires:  python%{python3_pkgversion}-pbr >= 2.0.0
BuildRequires:  python%{python3_pkgversion}-PyYAML
BuildRequires:  python%{python3_pkgversion}-requestsexceptions >= 1.2.0
BuildRequires:  python%{python3_pkgversion}-setuptools
BuildRequires:  python%{python3_pkgversion}-six >= 1.10.0


%if %{with test}
BuildRequires:  python%{python3_pkgversion}-sphinx
BuildConflicts: python%{python3_pkgversion}-coverage = 4.4
BuildRequires:  python%{python3_pkgversion}-appdirs >= 1.3.0
BuildRequires:  python%{python3_pkgversion}-coverage >= 4.0
BuildRequires:  python%{python3_pkgversion}-extras >= 1.0.0
BuildRequires:  python%{python3_pkgversion}-fixtures >= 3.0.0
BuildRequires:  python%{python3_pkgversion}-jsonschema < 3.0.0
BuildRequires:  python%{python3_pkgversion}-jsonschema >= 2.6.0
BuildRequires:  python%{python3_pkgversion}-mock >= 2.0.0
BuildRequires:  python%{python3_pkgversion}-oslotest >= 3.2.0
BuildRequires:  python%{python3_pkgversion}-python-subunit >= 1.0.0
BuildRequires:  python%{python3_pkgversion}-requests-mock >= 1.2.0
BuildRequires:  python%{python3_pkgversion}-stestr >= 1.0.0
BuildRequires:  python%{python3_pkgversion}-testrepository >= 0.0.18
BuildRequires:  python%{python3_pkgversion}-testscenarios >= 0.4
BuildRequires:  python%{python3_pkgversion}-testtools >= 2.2.0
%endif # with test

Conflicts:      python%{python3_pkgversion}-jsonpatch = 1.20
Conflicts:      python%{python3_pkgversion}-pbr = 2.1.0
Requires:       python%{python3_pkgversion}-appdirs >= 1.3.0
Requires:       python%{python3_pkgversion}-cryptography >= 2.1
Requires:       python%{python3_pkgversion}-decorator >= 3.4.0
Requires:       python%{python3_pkgversion}-deprecation >= 1.0
Requires:       python%{python3_pkgversion}-dogpile-cache >= 0.6.2
Requires:       python%{python3_pkgversion}-iso8601 >= 0.1.11
Requires:       python%{python3_pkgversion}-jmespath >= 0.9.0
Requires:       python%{python3_pkgversion}-jsonpatch >= 1.16
Requires:       python%{python3_pkgversion}-keystoneauth1 >= 3.8.0
Requires:       python%{python3_pkgversion}-munch >= 2.1.0
Requires:       python%{python3_pkgversion}-netifaces >= 0.10.4
Requires:       python%{python3_pkgversion}-os-service-types >= 1.2.0
Requires:       python%{python3_pkgversion}-pbr >= 2.0.0
Requires:       python%{python3_pkgversion}-PyYAML >= 3.11
Requires:       python%{python3_pkgversion}-requestsexceptions >= 1.2.0
Requires:       python%{python3_pkgversion}-setuptools
Requires:       python%{python3_pkgversion}-six >= 1.10.0


%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}

%description -n python%{python3_pkgversion}-%{pypi_name}
%{description}

%package -n python%{python3_pkgversion}-%{pypi_name}-tests
Summary:        An SDK for building applications to work with OpenStack - test files

Requires: python%{python3_pkgversion}-%{pypi_name} = %{version}-%{release}

%description -n python%{python3_pkgversion}-%{pypi_name}-tests
%{common_desc_tests}
%endif # with python3

%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
#rm -rf %{pypi_name}.egg-info

%build
%if %{with python2}
%py2_build
%endif # python2
%if %{with python3}
%py3_build
%endif # python3
# generate html docs 
# PYTHONPATH=${PWD} sphinx-build-3 doc/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
# Must do the default python version install last because
# the scripts in /usr/bin are overwritten with every setup.py install.
%if %{with python2}
%py2_install
%endif # python2
%if %{with python3}
%py3_install
%endif # python3

%check
%if %{with test}
%if %{with python2}
%{__python2} setup.py test
%endif - with python2
%if %{with python3}
%{__python3} setup.py test
%endif # with python3
%endif # with test

%if %{with python2}
%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE
%if !0%{?with_python3}
%{_bindir}/openstack-inventory
%endif
%{python2_sitelib}/openstack
%{python2_sitelib}/%{pypi_name}-*.egg-info
%exclude %{python2_sitelib}/openstack/tests

%files -n python2-%{pypi_name}-tests
%{python2_sitelib}/openstack/tests
%endif # with python2

%if %{with python3}
%files -n python%{python3_pkgversion}-%{pypi_name}
%doc README.rst
%license LICENSE
%{_bindir}/openstack-inventory
%{python3_sitelib}/openstack
%{python3_sitelib}/%{pypi_name}-*.egg-info
%exclude %{python3_sitelib}/openstack/tests
 
%files -n python%{python3_pkgversion}-%{pypi_name}-tests
%{python3_sitelib}/openstack/tests
%endif # with python3

%changelog
openSUSE Build Service is sponsored by