From 23abfb860bd72a4cf00f1c373cb74700e591d34b Mon Sep 17 00:00:00 2001 From: Scott Poore Date: Apr 03 2020 21:11:22 +0000 Subject: Fix spec file to work with current distros Bumping version to 3.2 also --- diff --git a/python-pytest-multihost.spec b/python-pytest-multihost.spec index 6520444..932aad4 100644 --- a/python-pytest-multihost.spec +++ b/python-pytest-multihost.spec @@ -1,18 +1,19 @@ -%if 0%{?rhel} -%global with_python3 0 -%else -%global with_python3 1 +%if 0%{?fedora} >= 30 || 0%{?rhel} >= 8 +%global default_python_ver 3 %endif -%if 0%{?rhel} && 0%{?rhel} <= 6 -%{!?__python2: %global __python2 /usr/bin/python2} -%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} -%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%if 0%{?default_python_ver} > 2 +%global with_python3 1 +%global __python %{__python3} +%global with_python2 0 +%else +%global with_python3 0 +%global with_python2 1 %endif %global srcname pytest-multihost %global modulename pytest_multihost -%global srcversion 3.1 +%global srcversion 3.2 %global versionedname %{srcname}-%{srcversion} Name: python-%{srcname} @@ -26,9 +27,7 @@ URL: https://github.com/encukou/%{srcname} Source0: https://github.com/encukou/%{srcname}/archive/v%{srcversion}.tar.gz#/%{versionedname}.tar.gz BuildArch: noarch -BuildRequires: python-devel -BuildRequires: python-setuptools -BuildRequires: pytest + %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -37,10 +36,21 @@ BuildRequires: openssh-clients BuildRequires: sshpass %endif +%if 0%{?with_python2} +BuildRequires: python-devel +BuildRequires: python-setuptools +BuildRequires: pytest +%endif + Requires: python Requires: pytest >= 2.4.0 Requires: openssh-clients + +%if 0%{?rhel} <= 7 +Requires: sshpass +%else Recommends: sshpass +%endif # Should use python_provide macros, but those won't work in older EPEL Provides: python2-%{srcname} @@ -83,9 +93,10 @@ rm -rf %{py3dir} cp -a . %{py3dir} %endif - %build +%if 0%{?with_python2} %{__python2} setup.py build +%endif %if 0%{?with_python3} pushd %{py3dir} @@ -95,7 +106,9 @@ popd %check # Do not run the test that needs passwordless SSH to localhost set up +%if 0%{?with_python2} %{__python2} -m pytest -m "not needs_ssh" +%endif %if 0%{?with_python3} pushd %{py3dir} @@ -104,11 +117,8 @@ popd %endif %install +%if 0%{?with_python2} %{__python2} setup.py install --skip-build --root %{buildroot} -%if 0%{?with_python3} -%py_byte_compile %{__python2} %{buildroot}%{python_sitelib}/%{srcname} -%else -# py_byte_compile is only defined in python3-devel %{__python2} -m compileall %{buildroot}%{python_sitelib}/%{srcname} %endif @@ -119,15 +129,13 @@ pushd %{py3dir} popd %endif +%if 0%{?with_python2} %files -%if 0%{?rhel} && 0%{?rhel} <= 6 -%doc COPYING -%else %license COPYING -%endif %doc README.rst -%{python_sitelib}/%{modulename}-%{version}-py2.?.egg-info -%{python_sitelib}/%{modulename}/ +%{python2_sitelib}/%{modulename}-%{version}-py2.?.egg-info +%{python2_sitelib}/%{modulename}/ +%endif %if 0%{?with_python3} %files -n python3-%{srcname} @@ -139,6 +147,10 @@ popd %changelog +* Fri Apr 03 2020 Scott Poore - 3.2-1 +- Spec file updates to fix build issues on some distros +- Bump version to 3.2 in setup.py also + * Thu Apr 02 2020 Scott Poore - 3.1-1 - Implement OpenSSH password auth with sshpass diff --git a/setup.py b/setup.py index a1b24ee..cb430c3 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with io.open('README.rst', 'rt', encoding='utf-8') as f: setup_args = dict( name = "pytest-multihost", - version = "3.1", + version = "3.2", description = "Utility for writing multi-host tests for pytest", long_description = readme_contents, url = "https://pagure.io/python-pytest-multihost",