# what it's called on pypi %global srcname pytest-datafiles # what it's imported as %global modname pytest_datafiles # name of egg info directory %global eggname pytest_datafiles # package name fragment %global pkgname pytest-datafiles %if %{defined rhel} || (%{defined fedora} && 0%{?fedora} < 32) %bcond_without python2 %endif %bcond_without python3 Name: python-%{srcname} Version: 2.0 Release: 2%{?dist} Summary: pytest plugin to create a tmpdir containing a preconfigured set of files and/or directories License: MIT URL: https://github.com/omarkohl/pytest-datafiles Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch %global _description \ This plugin allows you to specify one or several files/directories that are\ copied to a temporary directory (tmpdir) before the execution of the test.\ This means the original files are not modified and every test runs on its\ own version of the same files. %description %{_description} %if %{with python2} %package -n python2-%{srcname} Summary: Pytest plugin for coverage reporting BuildRequires: python2-devel BuildRequires: python2-setuptools BuildRequires: python2-pytest Requires: python2-pytest %{?python_provide:%python_provide python2-%{srcname}} %description -n python2-%{srcname} %{_description} %endif %if %{with python3} %package -n python3-%{srcname} Summary: Pytest plugin for coverage reporting BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pytest Requires: python3-pytest %{?python_provide:%python_provide python3-%{srcname}} %description -n python3-%{srcname} %{_description} %endif %prep %autosetup -n %{srcname}-%{version} %build %if %{with python2} %py2_build %endif %if %{with python3} %py3_build %endif %install %if %{with python2} %py2_install %endif %if %{with python3} %py3_install %endif %check %if %{with python2} PATH=%{buildroot}%{_bindir}:${PATH} \ PYTHONPATH=%{buildroot}%{python2_sitelib} \ %{__python2} setup.py test %endif %if %{with python3} PATH=%{buildroot}%{_bindir}:${PATH} \ PYTHONPATH=%{buildroot}%{python3_sitelib} \ %{__python3} setup.py test %endif %if %{with python2} %files -n python2-%{srcname} %license LICENSE %doc README.rst CHANGELOG.rst %{python2_sitelib}/%{modname}.py %{python2_sitelib}/%{eggname}-%{version}-py%{python2_version}.egg-info %{python2_sitelib}/%{modname}.{pyc,pyo} %endif %if %{with python3} %files -n python3-%{srcname} %license LICENSE %doc README.rst CHANGELOG.rst %{python3_sitelib}/%{modname}.py %{python3_sitelib}/%{eggname}-%{version}-py%{python3_version}.egg-info %{python3_sitelib}/__pycache__ %endif %changelog * Fri Dec 06 2019 gasinvein - 2.0-2 - Make python2 and python3 builds conditional