Blob Blame Raw
# 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

# Disable Python 2 builds for Fedora > 29, EPEL > 7
%if 0%{?fedora} > 29 || 0%{?rhel} > 7
%bcond_with         python2
%global obsolete2   1
%else
%bcond_without      python2
%global obsolete2   0
%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.2
# if set, will be a post-release snapshot build, otherwise a 'normal' build
#global github_commit   080d03858b7b12f144770af8ceb938fe6c7dbb11
#global github_date     20170130
%global shortcommit     %(c=%{github_commit}; echo ${c:0:7})

Name:           python-openqa_client
Version:        %{github_version}
Release:        1%{?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_version}/%{github_name}-%{github_version}.tar.gz
BuildArch:      noarch

%description
%{desc}


%if 0%{?with_python2}
%package -n python2-openqa_client
Summary:        %{sum}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
%{?python_provide:%python_provide python2-openqa_client}
Requires:       python2-requests
Requires:       python2-six

%description -n python2-openqa_client
%{desc} This is the
Python 2 build.
%endif # with_python2


%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-openqa_client
Summary:        %{sum}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
%{?python_provide:%python_provide python%{python3_pkgversion}-openqa_client}
%if 0%{?obsolete2}
Obsoletes:      python2-openqa_client < %{version}-%{release}
%endif # obsolete2
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}
BuildRequires:  python%{python3_other_pkgversion}-devel
BuildRequires:  python%{python3_other_pkgversion}-setuptools
%{?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_version}

%build
%if 0%{?with_python2}
%py2_build
%endif # with_python2
%if 0%{?with_python3}
%py3_build
%if 0%{?with_python3_other}
%py3_other_build
%endif # with_python3_other
%endif # with_python3

%install
%if 0%{?with_python2}
%py2_install
%endif # with_python2
%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.

%if 0%{?with_python2}
%files -n python2-openqa_client
%doc README.md CHANGELOG.md
%license COPYING
%{python2_sitelib}/openqa_client*
%endif # with_python2

%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
* Tue May 21 2019 Adam Williamson <awilliam@redhat.com> - 1.3.2-1
- New release 1.3.2 (updated constants for upstream changes)

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Nov 23 2018 Adam Williamson <awilliam@redhat.com> - 1.3.1-5
- Disable Python 2 build on F30+ / RHEL 8+

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 1.3.1-3
- Rebuilt for Python 3.7

* 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