# Enable Python 3 builds for Fedora + EPEL >5
%if 0%{?fedora} || 0%{?epel} > 5
# If the definition isn't available for python3_pkgversion, define it
%{?!python3_pkgversion:%global python3_pkgversion 3}
%bcond_without python3
%else
%bcond_with python3
%endif
%global sum Python client library for openQA API
%global desc The openqa_client Python library provides convenient access to the \
openQA web API, using the requests HTTP request library.
%global github_owner os-autoinst
%global github_name openQA-python-client
%global github_version 1.3.1
%global github_commit 080d03858b7b12f144770af8ceb938fe6c7dbb11
# if set, will be a post-release snapshot build, otherwise a 'normal' build
#global github_date 20170130
%global shortcommit %(c=%{github_commit}; echo ${c:0:7})
Name: python-openqa_client
Version: %{github_version}
Release: 2%{?github_date:.%{github_date}git%{shortcommit}}%{?dist}
Summary: %{sum}
License: GPLv2+
URL: https://github.com/%{github_owner}/%{github_name}/
Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
# No python2-setuptools on EPEL
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%if 0%{?with_python3_other}
BuildRequires: python%{python3_other_pkgversion}-devel
BuildRequires: python%{python3_other_pkgversion}-setuptools
%endif # with_python3_other
%endif # with_python3
%description
%{desc}
%package -n python2-openqa_client
Summary: %{sum}
%{?python_provide:%python_provide python2-openqa_client}
# No python2-foo on EPEL
Requires: python-requests
Requires: python-six
%description -n python2-openqa_client
%{desc} This is the
Python 2 build.
%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-openqa_client
Summary: %{sum}
%{?python_provide:%python_provide python%{python3_pkgversion}-openqa_client}
Requires: python%{python3_pkgversion}-requests
Requires: python%{python3_pkgversion}-six
%description -n python%{python3_pkgversion}-openqa_client
%{desc} This is the
Python %{python3_pkgversion} build.
%if 0%{?with_python3_other}
%package -n python%{python3_other_pkgversion}-openqa_client
Summary: %{sum}
%{?python_provide:%python_provide python%{python3_other_pkgversion}-openqa_client}
Requires: python%{python3_other_pkgversion}-requests
Requires: python%{python3_other_pkgversion}-six
%description -n python%{python3_other_pkgversion}-openqa_client
%{desc} This is the
Python %{python3_other_pkgversion} build.
%endif # with_python3_other
%endif # with_python3
%prep
%autosetup -p1 -n %{github_name}-%{github_commit}
%build
%py2_build
%if 0%{?with_python3}
%py3_build
%if 0%{?with_python3_other}
%py3_other_build
%endif # with_python3_other
%endif # with_python3
%install
%py2_install
%if 0%{?with_python3}
%py3_install
%if 0%{?with_python3_other}
%py3_other_install
%endif # with_python3_other
%endif # with_python3
%check
# FIXME: there are no tests yet. Bad me.
%files -n python2-openqa_client
%doc README.md CHANGELOG.md
%license COPYING
%{python2_sitelib}/openqa_client*
%if 0%{?with_python3}
%files -n python%{python3_pkgversion}-openqa_client
%doc README.md CHANGELOG.md
%license COPYING
%{python3_sitelib}/openqa_client*
%if 0%{?with_python3_other}
%files -n python%{python3_other_pkgversion}-openqa_client
%doc README.md CHANGELOG.md
%license COPYING
%{python3_other_sitelib}/openqa_client*
%endif # with_python3_other
%endif # with_python3
%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Tue Oct 10 2017 Adam Williamson <awilliam@redhat.com> - 1.3.1-1
- New release 1.3.1 (updated constants for upstream changes)
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Feb 15 2017 Adam Williamson <awilliam@redhat.com> - 1.3.0-1
- Initial package