%global pypi_name ansible-runner %global python3_sitelib /usr/lib/python3.6/site-packages/ %define _python_bytecompile_errors_terminate_build 0 %if 0%{?fedora} || 0%{?rhel} > 7 %bcond_with python2 %bcond_without python3 %else %bcond_without python2 %bcond_with python3 %endif Name: %{pypi_name} Version: {{ version }} Release: {{ release }}%{?dist} Summary: A tool and python library to interface with Ansible License: ASL 2.0 URL: https://github.com/ansible/ansible-runner Source0: https://github.com/ansible/%{name}/archive/%{version}.tar.gz?/%{name}-%{version}-{{ release }}.tar.gz BuildArch: noarch %if %{with python2} BuildRequires: python-rpm-macros BuildRequires: python2-setuptools Requires: python2-%{pypi_name} = %{version}-%{release} %endif %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-setuptools Requires: python3-%{pypi_name} = %{version}-%{release} %endif %description Ansible Runner is a tool and python library that helps when interfacing with Ansible from other systems whether through a container image interface, as a standalone tool, or imported into a python project. %if %{with python2} %package -n python2-%{pypi_name} Summary: %{summary} %{?python_provide:%python_provide python2-%{pypi_name}} Requires: python-setuptools Requires: python-daemon Requires: pexpect >= 4.6 Requires: PyYAML Requires: python-six Requires: python-lockfile %description -n python2-%{pypi_name} Ansible Runner is a tool and python library that helps when interfacing with Ansible from other systems whether through a container image interface, as a standalone tool, or imported into a python project. %endif %if %{with python3} %package -n python3-%{pypi_name} Summary: %{summary} %{?python_provide:%python_provide python3-%{pypi_name}} Requires: python3-pyyaml Requires: python3-setuptools Requires: python3-daemon Requires: python3-six Requires: python3dist(pexpect) >= 4.6 Requires: python3dist(lockfile) %description -n python3-%{pypi_name} Ansible Runner is a tool and python library that helps when interfacing with Ansible from other systems whether through a container image interface, as a standalone tool, or imported into a python project. %endif %prep %autosetup -n %{pypi_name}-%{version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info %global py_setup setup.py %build %if %{with python2} export RHEL_ALLOW_PYTHON2_FOR_BUILD=1 python2 setup.py build %endif %if %{with python3} python3 setup.py build %endif %install # Must do the subpackages' install first because the scripts in /usr/bin are # overwritten with every setup.py install. %if %{with python3} python3 setup.py install -O1 --skip-build --root %{buildroot} cp %{buildroot}/%{_bindir}/ansible-runner %{buildroot}/%{_bindir}/ansible-runner-%{python3_version} ln -s %{_bindir}/ansible-runner-%{python3_version} %{buildroot}/%{_bindir}/ansible-runner-3 %endif %if %{with python2} export RHEL_ALLOW_PYTHON2_FOR_BUILD=1 python2 setup.py install -O1 --skip-build --root %{buildroot} cp %{buildroot}/%{_bindir}/ansible-runner %{buildroot}/%{_bindir}/ansible-runner-%{python2_version} ln -s %{_bindir}/ansible-runner-%{python2_version} %{buildroot}/%{_bindir}/ansible-runner-2 %endif %files %defattr(-,root,root) %if %{with python2} %files -n python2-%{pypi_name} %{_bindir}/ansible-runner %{_bindir}/ansible-runner-2 %{_bindir}/ansible-runner-%{python2_version} %{python_sitelib}/* %endif %if %{with python3} %files -n python3-%{pypi_name} %{python3_sitelib}/* %{_bindir}/ansible-runner %{_bindir}/ansible-runner-3 %{_bindir}/ansible-runner-%{python3_version} %endif %changelog * Thu Mar 19 2020 Ryan Petrello - 1.4.6-1 - Ansible Runner 1.4.6-1 * Thu Mar 19 2020 Matthew Jones - 1.4.5-1 - Ansible Runner 1.4.5-1 * Tue Feb 25 2020 Yanis Guenane - 1.4.4-3 - Ansible Runner 1.4.4-3 * Fri Oct 25 2019 Matthew Jones - 1.4.4-1 - Ansible Runner 1.4.4-1 * Thu Oct 17 2019 Matthew Jones - 1.4.2-1 - Ansible Runner 1.4.2-1 * Thu Oct 03 2019 Matthew Jones - 1.4.1-1 - Ansible Runner 1.4.1-1 * Mon Sep 23 2019 Shane McDonald - 1.4.0-1 - Ansible Runner 1.4.0-1 - Support for EL 7.7 (defaults to python2) * Wed Apr 24 2019 Shane McDonald - 1.3.4-1 - Ansible Runner 1.3.4-1 - Adopted modified upstream spec file for python3 support