%global pyname python-digitalocean %global pkgname digitalocean %if 0%{?rhel} && 0%{?rhel} <= 7 %bcond_with python3 %else %bcond_without python3 %endif Name: python-%{pkgname} Version: 1.13.2 Release: 1%{?dist} Summary: Easy access to Digital Ocean APIs to deploy droplets, images and more License: LGPLv3 URL: https://pypi.python.org/pypi/python-digitalocean Source0: https://github.com/koalalorenzo/%{pyname}/archive/v%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-mock BuildRequires: python2-responses BuildRequires: python2-setuptools %if 0%{?rhel} && 0%{?rhel} <= 7 # EL7 has unversioned names for these packages BuildRequires: pytest BuildRequires: python-requests %else BuildRequires: python2-pytest BuildRequires: python2-requests %endif %if 0%{?fedora} && 0%{?fedora} <= 26 # Fedora 26 has an unversioned name for this package BuildRequires: python-jsonpickle %else BuildRequires: python2-jsonpickle %endif %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-mock BuildRequires: python3-pytest BuildRequires: python3-requests BuildRequires: python3-responses BuildRequires: python3-setuptools %endif %description Easy access to Digital Ocean APIs to deploy droplets, images and more. %package -n python2-%{pkgname} %if 0%{?fedora} && 0%{?fedora} <= 26 # Fedora 26 has an unversioned name for this package BuildRequires: python-jsonpickle %else BuildRequires: python2-jsonpickle %endif %if 0%{?rhel} && 0%{?rhel} <= 7 # EL7 has an unversioned name for this package BuildRequires: python-requests %else BuildRequires: python2-requests %endif Summary: %{summary} %{?python_provide:%python_provide python2-%{pkgname}} %description -n python2-%{pkgname} Easy access to Digital Ocean APIs to deploy droplets, images and more. This is the Python 2 version of the package. %if %{with python3} %package -n python3-%{pkgname} BuildRequires: python3-jsonpickle BuildRequires: python3-requests Summary: %{summary} %{?python_provide:%python_provide python3-%{pkgname}} %description -n python3-%{pkgname} Easy access to Digital Ocean APIs to deploy droplets, images and more. This is the Python 3 version of the package. %endif %prep %autosetup -p1 -n %{pyname}-%{version} %build %py2_build %if %{with python3} %py3_build %endif %check %{__python2} setup.py test %if %{with python3} %{__python3} setup.py test %endif %install %py2_install %if %{with python3} %py3_install %endif %files -n python2-%{pkgname} %license LICENSE.txt %doc README.md %{python2_sitelib}/digitalocean %{python2_sitelib}/python_digitalocean-%{version}*.egg-info %if %{with python3} %files -n python3-%{pkgname} %license LICENSE.txt %doc README.md %{python3_sitelib}/digitalocean %{python3_sitelib}/python_digitalocean-%{version}*.egg-info %endif %changelog * Mon Feb 12 2018 Eli Young - 1.13.2-1 - Initial package