#19 Fix spec file to work with current distros
Merged 3 years ago by spoore. Opened 3 years ago by spoore.
spoore/python-pytest-multihost spec_fix_for3.1  into  master

file modified
+35 -23
@@ -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 @@ 

  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: 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 @@ 

  cp -a . %{py3dir}

  %endif

  

- 

  %build

+ %if 0%{?with_python2}

  %{__python2} setup.py build

+ %endif

  

  %if 0%{?with_python3}

  pushd %{py3dir}
@@ -95,7 +106,9 @@ 

  

  %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 @@ 

  %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 @@ 

  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 @@ 

  

  

  %changelog

+ * Fri Apr 03 2020 Scott Poore <spoore1@gmail.com> - 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 <spoore1@gmail.com> - 3.1-1

  - Implement OpenSSH password auth with sshpass

  

file modified
+1 -1
@@ -11,7 +11,7 @@ 

  

  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",

Bumping version to 3.2 also

Pull-Request has been merged by spoore

3 years ago