From 2c66a2d34a80dbe90739ac8b5eb8eea174718171 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Nov 23 2018 23:58:26 +0000 Subject: Disable Python 2 build on F30+ --- diff --git a/python-mwclient.spec b/python-mwclient.spec index 2d9c731..76e357a 100644 --- a/python-mwclient.spec +++ b/python-mwclient.spec @@ -1,20 +1,28 @@ -# Python 3 and tests only for Fedora for now: some deps missing on -# EL 7 +# Python 3 for Fedora for now: some deps missing on EL 7 %if 0%{?fedora} > 12 %global with_python3 1 %endif -%if 0%{?fedora} > 12 || 0%{?rhel} > 6 -%global with_tests 1 + +# 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 + +# used for annoying deps which don't provide 'python2-foo' on EPEL +%if 0%{?rhel} && 0%{?rhel} < 8 +%global py2_prefix python +%else +%global py2_prefix python2 %endif # packages required at both test time and run time -%if 0%{?rhel} < 8 # python-requests-oauthlib is in RHEL 7 but does not provide # python2-requests-oauthlib -%global test_requires2 python2-requests python-requests-oauthlib python2-six -%else -%global test_requires2 python2-requests python2-requests-oauthlib python2-six -%endif +%global test_requires2 python2-requests %{py2_prefix}-requests-oauthlib python2-six %global test_requires3 python3-requests python3-requests-oauthlib python3-six python3-simplejson %global github_owner mwclient @@ -31,59 +39,60 @@ URL: https://github.com/%{github_owner}/%{github_name} Source0: https://github.com/%{github_owner}/%{github_name}/archive/v%{version}.tar.gz BuildArch: noarch +%description +mwclient is a lightweight Python client library to the MediaWiki API which +provides access to most API functionality. + +%if 0%{?with_python2} +%package -n python2-%{github_name} +Summary: %{summary} +%{?python_provide:%python_provide python2-%{github_name}} + BuildRequires: python2-devel # For EPEL BuildRequires: python2-setuptools -%if 0%{?with_tests} BuildRequires: python2-pytest # Provides: python2-pytest-pep8 missing on < F26 BuildRequires: python2-pytest-pep8 # python2-pytest-cache provide doesn't exist on EPEL 7 and making it # happen is kind of a nightmare due to tricky arch issues with # eventlet/greenlet -BuildRequires: python-pytest-cache +BuildRequires: %{py2_prefix}-pytest-cache BuildRequires: python2-pytest-cov BuildRequires: python2-pytest-runner BuildRequires: python2-mock BuildRequires: python2-funcsigs BuildRequires: python2-responses >= 0.3.0 BuildRequires: %{test_requires2} -%endif # if with_tests -%if 0%{?with_python3} -BuildRequires: python3-devel -%if 0%{?with_tests} -BuildRequires: python3-pytest -BuildRequires: python3-pytest-pep8 -BuildRequires: python3-pytest-cache -BuildRequires: python3-pytest-cov -BuildRequires: python3-pytest-runner -BuildRequires: python3-mock -BuildRequires: python3-funcsigs -BuildRequires: python3-responses >= 0.3.0 -BuildRequires: %{test_requires3} -%endif # if with_tests -%endif # if with_python3 - -%description -mwclient is a lightweight Python client library to the MediaWiki API which -provides access to most API functionality. - -%package -n python2-%{github_name} -Summary: %{summary} -%{?python_provide:%python_provide python2-%{github_name}} -Requires: python-simplejson +Requires: python2-simplejson Requires: %{test_requires2} %description -n python2-%{github_name} %{github_name} is a lightweight Python client library to the MediaWiki API which provides access to most API functionality. This is the Python 2 build of %{github_name}. +%endif # if with_python2 %if 0%{?with_python3} %package -n python3-%{github_name} Summary: %{summary} %{?python_provide:%python_provide python3-%{github_name}} +%if 0%{?obsolete2} +Obsoletes: python2-%{github_name} < %{version}-%{release} +%endif # obsolete2 + +BuildRequires: python3-devel +BuildRequires: python3-pytest +BuildRequires: python3-pytest-pep8 +BuildRequires: python3-pytest-cache +BuildRequires: python3-pytest-cov +BuildRequires: python3-pytest-runner +BuildRequires: python3-mock +BuildRequires: python3-funcsigs +BuildRequires: python3-responses >= 0.3.0 +BuildRequires: %{test_requires3} + Requires: %{test_requires3} %description -n python3-%{github_name} @@ -97,32 +106,38 @@ provides access to most API functionality. This is the Python 3 build of %build +%if 0%{?with_python2} %py2_build +%endif # if with_python2 %if 0%{?with_python3} %py3_build %endif # if with_python3 %install +%if 0%{?with_python2} %py2_install +%endif # if with_python2 %if 0%{?with_python3} %py3_install %endif # if with_python3 %check -%if 0%{?with_tests} +%if 0%{?with_python2} %{__python2} setup.py test +%endif # if with_python2 %if 0%{?with_python3} %{__python3} setup.py test %endif # if with_python3 -%endif # if with_tests +%if 0%{?with_python2} %files -n python2-%{github_name} %doc README.md REFERENCE.md CHANGELOG.md %license LICENSE.md %{python2_sitelib}/%{github_name}* +%endif # if with_python2 %if 0%{?with_python3} %files -n python3-%{github_name}