# 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, EPEL > 7
%if 0%{?fedora} || 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 3.0.4
# 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
# test requirements
BuildRequires: python2-pytest
BuildRequires: python2-freezegun
BuildRequires: python2-mock
BuildRequires: python2-requests
BuildRequires: python2-six
%{?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
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-freezegun
BuildRequires: python%{python3_pkgversion}-requests
BuildRequires: python%{python3_pkgversion}-six
%{?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
# we're not supposed to use setup.py test any more, apparently, but
# the shiny/scary new pyproject-rpm-macros stuff isn't available on
# EPEL yet, so...let's just try and use py.test directly, against
# the path we installed to.
%if 0%{?with_python2}
PYTHONPATH=%{buildroot}%{python2_sitelib} py.test
%endif # with_python3
%if 0%{?with_python3}
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-3
%endif # with_python3
%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
* Thu Feb 27 2020 Adam Williamson <awilliam@redhat.com> - 3.0.4-1
- New release 3.0.4
- Run tests in %check (now there are some)
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Jan 06 2020 Adam Williamson <awilliam@redhat.com> - 2.0.0-1
- Update to new release 2.0.0 (JOB_INCOMPLETE_RESULTS removed)
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.3.2-4
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.3.2-3
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* 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